/ Published in: jQuery
Execute function / action when an element has loaded or clicked.
Originally seen here: http://www.codingforums.com/archive/index.php/t-144582.html
Originally seen here: http://www.codingforums.com/archive/index.php/t-144582.html
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <script type="text/javascript" src="jquery/jquery.js"></script> <script type="text/javascript"> $(document.getElementsByTagName('div')[0]).ready(function() { // do stuff when div is ready alert('loaded'); }); $(document.getElementById('mydiv')).click(function() { // do stuff when clicked alert('clicked'); }); </script> </head> <body> <div id="mydiv">My Div</div> </body> </html>
URL: http://www.codingforums.com/archive/index.php/t-144582.html