Jump to content

Getting value of text when clicked.


GB_001

Recommended Posts

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.