An easy mistake to make. Code in the head runs before the rest of the
document is loaded. That means that when you do $("a") there isn't actually
any A's in the document yet.
To ensure that your code only runs when the document is ready, put it in
this structure:
$(function() {
...
});
jQuery will automatically queue this function to run after page is loaded.
Blair
On 1/24/07, Johannes Theile <[EMAIL PROTECTED]> wrote:
Hi,
I came across jQuery, I thinks I might like it, but I'm unable to try it
out.
I downloaded the uncompressed version and just c&p one of the examples
from
the Wiki. But nothing happens. I tried it with various browsers on two
systems, but nothing works. So I thinks that I'm doing a general mistake.
Maybe someone could check the code below.
#####
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$("a").click(function(){
alert("Thanks for visiting!");
});
</script>
</head>
<body>
# Do something!
</body>
</html>
#####
jQuery is in the same folder as my html page is.
Any help is appreciated.
Regards,
Johannes
--
View this message in context:
http://www.nabble.com/Beginner-needs-help---Basics-tf3080171.html#a8557894
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/