Skip to content Skip to sidebar Skip to footer

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).

<scripttype="text/javascript">function_select(a) {
    document.getElementById("demo").innerHTML = a;
  }
</script><pid="demo"></p><inputtype="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:

<scripttype="text/javascript">functionselect1(a) {
    console.log(a);
    document.getElementById("demo").innerHTML = a;
  }
</script><inputtype="checkbox"onchange="select1('XYZ')"name="xyz"value="xyz"><pid="demo"></p>
you should change your function name becouse there is collision occurs that's why it's not working try above

Post a Comment for "Onchange Event Handler Not Working"