Prior to jQuery, the way to get JavaScript to fire on loading a page was to add an onload attribute to the body HTML tag:
<body onload="mycode();">
In jQuery, this can be replaced by:
<script type="text/javascript">$(mycode);</script>
The important thing is not to include the method brackets. $(mycode()); will not work.
Thursday, 24 May 2012
Subscribe to:
Posts (Atom)