sniger
asked on
javascript simple question
why when I put javascript code into <head> section , it is not working, only when I
put it into body section:
put it into body section:
<head>
/* read jquery etc */
</head>
<body>
<select>
<option> 1 </option>
<option> 2 </option>
</select>
<script>
$("select").change(function() {
var sel = $(this).val();
if (sel != 0 )
{
}
});
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
JavaScript writes into the HTML <body> while the page loads.
Please check this link.
http://www.w3schools.com/js/js_howto.asp