I am putting some content read through ajax in a div
.
The content has certain script tags which are used to bind some events on some element contained in the ajax content.
Ajax Content:
<div>
<div>
<select id='mySelectBox'>
<option value="1">ONE</option>
<option value="2" selected="selected">TWO</option>
</select>
</div>
<script type="text/javascript">
$(document).on("change",'#mySelectBox',function(){
alert($('#mySelectBox').val());
});
$('#mySelectBox).change(); //problem here....
</script>
</div>
The change event is bind and working correctly when i change the value of '#mySelectBox'
.
But here in $('#mySelectBox).change();
statement which triggers the change event immediately after it is bind is not getting called.
what might be the problem.?