Hi Mark,

Make sure you return false so that the link doesn't trigger the default behavior (which is to go to the url):

$(document).ready(function() {
   $("a").click(function() {
      alert("Hello world!");
      return false;
   });
 });



--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Oct 24, 2007, at 9:09 AM, mark wrote:


Hi All,

I am a new person to the world of jQuery.

I am having a problem in my first program only. Please tell me what is
wrong over here.

My code is :

<html><head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
        $(document).ready(function() {
   $("a").click(function() {
     alert("Hello world!");
   });
 });
</script></head>
<body>
        <a href="http://google.com";>google</a>
</body>
</html>

Output which I am getting is :

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss
\fcharset0 Arial;}} {\*\generator Msftedit
5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 \par \par \par \par \tab
google\par \par \par }


Reply via email to