val is used for input fields, to get the text inside a tag you have to use html or text depending on what you are after.
-- David Duymelinck Sharique schreef:
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)
-- David Duymelinck ________________ [EMAIL PROTECTED]