Return to Snippet

Revision: 43852
at April 1, 2011 05:15 by reverend


Initial Code
<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>

Initial URL
http://www.codingforums.com/archive/index.php/t-144582.html

Initial Description
Execute function / action when an element has loaded or clicked.

Originally seen here: http://www.codingforums.com/archive/index.php/t-144582.html

Initial Title
execute / do stuff when element is ready

Initial Tags
jquery

Initial Language
jQuery