Tuesday, 15 May 2012

javascript - jquery add script and it loads as soon as DOM is loaded -



javascript - jquery add script and it loads as soon as DOM is loaded -

lets have

<html> <head> <script> function myfunction() { // blah blah } </script> </head> <body> <select name="myselect"> <option value="1"> </option> <option value="2"> hi </option> <option value="3"> ho </option> </select> </body> </html>

lets have js function generates 'select' script. how can add together default script ran dom loaded jquery?

something that:

<select name="myselect" script="myfunction()"> <option value="1"> </option> <option value="2"> hi </option> <option value="3"> ho </option> </select>

$(window).load(function() { // code here });

useful stuff here

javascript jquery function attributes

No comments:

Post a Comment