mardi 19 juillet 2016

Variable in checkbox id not passed in IE

I'm facing a problem with passing variable to id attribute in Javascript. The following script works with Chrome, but fails with IE, Edge, Android.

function add_file(selected_file) {
if(document.compile_list[selected_file].checked == true){ 
document.compile_list.selected_files.value += selected_file + ",";
} 
else {
in_value = document.compile_list.selected_files.value; 
name_comma = selected_file + ","; 
res_value = in_value.replace(name_comma, "");
document.compile_list.selected_files.value = res_value;
}
}

The form input tag is as follows:

<INPUT type='checkbox' id='2017_06_20_12_22_12' onChange='add_file("2017_06_20_12_22_12");'>

Any help would be very much appreciated.




Aucun commentaire:

Enregistrer un commentaire