HTML and JQUERY onchange not working

You are calling whole logic in onchange, you got wrong double qoutes (not sure but may be causing issue). Also document.getElementByid should be document.getElementById (see I in capital for Id)

You should write a separate Javascript function and call it on change event of input.

So change below line

<br><input list="Service" name="Service" value="** Select **" onchange=”document.getElementByid(document.getElementByid("Service").value).style.visibility='visible';” >

to

<br><input list="Service" name="Service" value="** Select **" onchange="serviceChange(this);" >

And add javascript function like below :

<script>
   function serviceChange(selectVar)
   {
     var value = selectVar.value;
     document.getElementById(value).style.visibility = "visible";
   }
</script>

Leave a Comment