I submit my form when the onchange event of my drop down is fired using jQuery.
The first time it works, but the second time the onchange event is not fired. It does not even enter into the jQuery script. How can I resolve this issue? And how do I load jQuery in the onload event?
My Jquery Code:
$('#statusId').bind('change',function() {
alert($(this).val());
$('#statusHiddenId').val($(this).val());
$('#layoutFormID').attr('method', 'POST');
$('#layoutFormID').attr('action', '/sample');
$('#layoutFormID').submit();
});
HTML CODE:
select(name='status',rel = "external", id='statusId', data-theme='a', data-icon='gear', data-native-menu="false")
option(value='0') All Status
option(value='1') New
option(value='2') Verified
option(value='3') KYC Completed
option(value='4') Loan Sanctioned
option(value='5') Loan Disbursed
option(value='6') Closed
option(value='7') Archive
Try this:
put this code inside javascript function and call it each time by onchange.
onchange = MyFunction();