OnChange Event Handler Not Working
I'm using onchange event handler with an input element. I know it's simple, I just added an onchange attribute. But it's not at all working also not showing any kind of error in co
Solution 1:
select
is a reserved word in JavaScript (sort of).
<script type="text/javascript">
function _select(a) {
document.getElementById("demo").innerHTML = a;
}
</script>
<p id="demo"></p>
<input type="checkbox" onchange="_select('XYZ')">
Solution 2:
Javascript has a list of reserved keywords which cannot be used as function names or variable names.
For a complete list, check this link: http://www.w3schools.com/js/js_reserved.asp
Solution 3:
<script type="text/javascript">
function select1(a) {
console.log(a);
document.getElementById("demo").innerHTML = a;
}
</script>
<input type="checkbox" onchange="select1('XYZ')" name="xyz" value="xyz">
<p id="demo"></p>
Post a Comment for "OnChange Event Handler Not Working"