ari_aaron Posted December 9, 2007 Share Posted December 9, 2007 Is is possible to retrieve the onClick code for an element? <a href="#" onClick="alert('hi!')" title="hi"> I want to retrieve the alert('hi!'). Is that possible? Thanks, Ari Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 9, 2007 Share Posted December 9, 2007 <script language="javascript"> function innerClick() { var clicker = document.getElementById('link1').attributes.onclick.value document.getElementById('display').innerHTML = clicker; } </script> <a id="link1" href="#" onClick="alert('hi!')" title="hi" onmouseup="innerClick()">test</a><br><br> <span id="display"></span> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 9, 2007 Share Posted December 9, 2007 ari_aaron you must have been waiting in the wings for that script - that's the fastest I have ever seen anybody mark a issue, that I solved for them, as "SOLVED". Quote Link to comment Share on other sites More sharing options...
ari_aaron Posted December 9, 2007 Author Share Posted December 9, 2007 I have email notification Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 9, 2007 Share Posted December 9, 2007 oh - cool 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.