Try this way:

   $("a").click( function( )
       {
               alert($(this).text());
               return false;
       });

zizi

On 10/10/07, Juan G. Hurtado <[EMAIL PROTECTED]> wrote:
>
> Try with $("a").html()
>  El 10/10/2007, a las 8:57, Sharique escribió:
>
>
>
> What I want to is :When user click on a link it will show text inside
> the <a> tag. (ie. when user click in "more" it will show "more" in
> alert.)
>
>
> I have following code :
> ---------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
> <title>jq test</title>
> <script type="text/javascript" src="js/jquery.js"></script>
> <script type="text/javascript">
> $(function() {
>
>
>
>
> $("a").click( function( )
> {
> alert($("a").val()); // shows error
>
>
> });
> });
> </script>
> </head>
> <body>
> <a href="#">tata</a>
> <a href="#">test</a>
> <a href="#">more</a>
> </body>
> </html>
> -----------
> When I run this code it shows following error.
> TypeError: this[0].value has no properties
> at anonymous(void) (test/jq/js/jquery.js:335)
> at anonymous() (test/jq/alinks.htm:13)
> at anonymous(Object) (test/jq/js/jquery.js:1776)
> at anonymous() (test/jq/js/jquery.js:1620)
>
>
>
>
>  --
> Juan G. Hurtado
> [EMAIL PROTECTED]
>
>
>

Reply via email to