Rifts Posted January 10, 2011 Share Posted January 10, 2011 I have a very simple example <body> <p>First Paragraph</p> <p>Second Paragraph</p> <p>Yet one more Paragraph</p> <script> $("p").click(function () { alert( $(this) ); //this is the line im messing with }); $("p").hover(function () { $(this).addClass("hilite"); }, function () { $(this).removeClass("hilite"); }); </script> </body> I just want to click and an alert will pop up displaying the text between the <p></p> I clicked but it only says [object Object] instead of "First Paragraph" Thanks Quote Link to comment https://forums.phpfreaks.com/topic/223966-simple-jquery-getting-value/ Share on other sites More sharing options...
RichardRotterdam Posted January 10, 2011 Share Posted January 10, 2011 http://api.jquery.com/text/ http://api.jquery.com/html/ Quote Link to comment https://forums.phpfreaks.com/topic/223966-simple-jquery-getting-value/#findComment-1157413 Share on other sites More sharing options...
Rifts Posted January 10, 2011 Author Share Posted January 10, 2011 thanks a ton figured it out! alert( $(this).text() ); it was so simple lol Quote Link to comment https://forums.phpfreaks.com/topic/223966-simple-jquery-getting-value/#findComment-1157416 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.