I have dynamically generated checkboxes on a page. I use onchange function and it works fine in Firefox:
function setActionDate(cb_id,dt_id){
//alert(cb_id);
var cbox = document.getElementById(cb_id);
var ddate= document.getElementById(dt_id);
alert(cbox.value);
if (cbox.value == 'Y') {
ddate.className = "";
ddate.style.backgroundColor="#ffe6e6";
ddate.placeholder = "Select Date";
} else if (cbox.value == 'N'){
ddate.value = "";
ddate.className = "disabled";
ddate.style.backgroundColor="";
ddate.placeholder = "";
}
}
I read here that IE treats onchange event differently and it is preferably to use onclick function. However I absolutely need to use oncahnge function. Is there a way to resolve it for IE and Chrome?
Aucun commentaire:
Enregistrer un commentaire