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 Link to comment https://forums.phpfreaks.com/topic/80830-solved-onclick-event/ 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> Link to comment https://forums.phpfreaks.com/topic/80830-solved-onclick-event/#findComment-410088 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". Link to comment https://forums.phpfreaks.com/topic/80830-solved-onclick-event/#findComment-410091 Share on other sites More sharing options...
ari_aaron Posted December 9, 2007 Author Share Posted December 9, 2007 I have email notification Link to comment https://forums.phpfreaks.com/topic/80830-solved-onclick-event/#findComment-410095 Share on other sites More sharing options...
phpQuestioner Posted December 9, 2007 Share Posted December 9, 2007 oh - cool Link to comment https://forums.phpfreaks.com/topic/80830-solved-onclick-event/#findComment-410100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.