.change call in jquery is not working when I change value through Javascript.
For example:
$(document).ready(function () {
$(function () {
$("select#product").change(function () {
if (document.all("fatcaSearchDO.bankId").disabled.value = true) {
fnFieldEnableClass(document.all("fatcaSearchDO.bankId"));
}
$.ajax({
type: 'GET',
url: 'ViewHistoryDataAction.do',
data: {
product: $(this).val()
},
dataType: 'JSON',
cache: false,
success: function (j) {
var options = '';
for (var k = 0; k < j.length; k++) {
options += '<option value="' + j[k] + '">' + j[k] + '</option>';
}
$("select#BankID").html(options);
}
});
});
});
});
<html:select name="ViewHistoryForm" property="fatcaSearchDO.bankId" styleClass="login-textbox" onchange="fnGlobalChange();" onclick="checkRadio('1')" onfocus = "checkRadio('1')" styleId="BankID" style="width=250">
<html:select name="ViewHistoryForm" property="fatcaSearchDO.product" styleClass="login-textbox" onchange="fnGlobalChange();" onclick="checkRadio('1')" onfocus = "checkRadio('1')" styleId="product" style="width=250">
Here when I try to change the drop down of "product" its calling action and the respective bank id values are populated. Now, when I try to change the value of "product" through javascript, for instance
<input type="button" onclick="changeProd()">
function changeProd(){
document.all("fatcaSearchDO.product").value='CC';
}
the change function is not working.