style.css" type="text/css" rel="stylesheet" />
alert
at the top of your file and/or function and see if it shows up.form
tag on your page. If you do, it will treat any button click as an attempt to submit that form, which will refresh your page.
$
function work?
textarea
in my JS code?
value
, not innerHTML
, of the text area. Use jQuery's val()
method to get the value.
for
or while
loop for animation work?
setInterval
function.
setInterval
to implement my timer, but I want to use setTimeout
instead. Is that okay?
setTimeout
would require you to keep setting timers over and over again, one to display each frame. This is inefficient for the browser. Use setInterval
.
id
or class
properties of an HTML tag in JavaScript?
attr
or hasClass
methods respectively.
$
) in global variables, because you can easily access these objects again by calling $
again.
click
handler? $("mybutton").click(myFunction(42));
$("mybutton").click(f); ... function f() { myFunction(42); }
// anonymous function; harder to read $("mybutton").click(function() { myFunction(42); });