Reputation: 101
I have this order question related top javascript. In the aspx page I have this SubmissionMaintenance.init
that call this return classes in javascript getRecord
and saveRecord
. I wanted to add a $("#ddlCompany").change
event and no matter when I add it it will never get called.
aspx Page
<script type="text/javascript">
$(document).ready(function () {
SubmissionMaintenance.init();
});
JS Page
return {
init: function () {
getRecord();
saveRecord();
}
}
var getRecord = function () {
html += "<select class='form-control select2-multiple' multiple='multiple' id='ddlCompany' name='ddlCompany' >";
$("#submission").html(html);
}
Upvotes: 0
Views: 52
Reputation: 2128
You'll need to add the change event listener to a parent element because the element you want to listen to is added after the dom has loaded.
Try this:
$( "#submission" ).on( "change", "#ddlCompany", function() {
console.log( '#ddlCompany change' );
});
Upvotes: 2