how to stop firing change event when page loaded
here's my code. when you load the page, alert shows up. is there a way to stop that? i only want alert to show when I change the selected item from dropdown list.
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("#s1").change(function () {
alert("sdfsdfsdf");
})
.change();
});
</script>
<style>
div { color:red; }
</style>
</head>
<body>
<select id="s1" name="sweets">
<option>Chocolate</option>
<option>Candy</option>
</select>
<div></div>
</body>
</html>