Last active
December 22, 2015 03:28
-
-
Save obi-a/6409877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#document ready | |
jQuery ($) -> | |
#Set the size attribute of the zipcode field to 10 | |
$("#zipcode").attr("size", "10") | |
#get size attribute for zipcode | |
zipcode_size = $("#zipcode").attr("size") | |
#Remove the size attribute from zipcode | |
$("#zipcode").removeAttr("size") | |
#get zipcode value | |
zipcode = $("#zipcode").val() | |
#set value of zipcode field | |
$("#zipcode").val("12345") | |
#get page title | |
title = $("title").text() | |
#get html of first h1 | |
hdr = $("h1").html() | |
#turn h1 to black when clicked on | |
$("h1").click () -> | |
$(this).css("color", "black") | |
#turn background to gray when zipcode field loses focus | |
$("#zipcode").blur () -> | |
$(this).css("background-color", "gray") | |
#change zip code to 00000 | |
do_something = () -> | |
$("#zipcode").val("00000") | |
#run the function do_something when h1 is double clicked | |
$("h1").bind('dblclick', do_something) | |
#trigger a doubleclick event on h1 | |
$("h1").trigger("dblclick") | |
#trigger a form submission | |
$("#payment-form").trigger("submit") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment