Hi Shishir,
If you're including the script in the <head> of the page or from a
separate file, you'll need to wrap the code in $(document).ready --
or one of the shorthands for it, like so:
$(document).ready(function() {
$("a").click(function(){
$(this).hide("slow");
return false;
});
});
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 9, 2007, at 5:18 AM, Shishir Srivastava wrote:
Hi All,
Just started working on jQuery. Here's my simple piece of code
borrowed from the tutorials section of jQuery page.
<html>
<head>
<script type="text/javascript" src="http://jquery.com/src/
jquery.js"></script>
<script type="text/javascript">
$("a").click(function(){
$(this).hide("slow");
return false;
});
</script>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
</body>
</html>
Now when I open this html file in either firefox, or IE , it doesn't
do what it's supposed to, i.e. slowly hide the link and remain on the
same page, but instead it open the specified link page.
Can anyone please verify what's wrong here.
Thanks,
Shishir