GB_001 Posted May 27, 2008 Share Posted May 27, 2008 Hello, is it possible to get the value of any onclick event link when clicked, through some sort of system? Quote Link to comment Share on other sites More sharing options...
GB_001 Posted May 28, 2008 Author Share Posted May 28, 2008 For example putting clicked text into a variable. Quote Link to comment Share on other sites More sharing options...
haku Posted May 28, 2008 Share Posted May 28, 2008 Yes, although how you do it depends on the type of tag that you are doing this on. For example the functions to extract the text from a textarea are different from the function used to extract the text from a div or a p. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 28, 2008 Share Posted May 28, 2008 sounds like you want to use the keyword 'this', which refers to the object be clicked. example: <script type="text/javascript"> function alertText ( text ) { alert(text); } </script> <div id="foobar" onclick="alertText(this.id);">Click Me</div> Quote Link to comment Share on other sites More sharing options...
GB_001 Posted May 28, 2008 Author Share Posted May 28, 2008 Thankyou! Quote Link to comment 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.