javascript - html visibility style doesn't work -


I have a strange problem. I have a button, "next button" which I initially want to hide, but when one If the checkbox is clicked, it should look like. The code below does not work and it does not give any error. I tested it on IE9 and Firefox. 13 I searched other queries but I could not find this problem ...

  & Lt; Html & gt; & Lt; Top & gt; & Lt; Script language = "javascript" & gt; Enable Function () {Warning ("Clicked"); Var s1 = document.getElementsByName ("Next button"); S1.style.visibility = "visible"; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Input type = "submit" name = "next button" value = "next" style = "visibility: hidden;" /> & Lt; Input type = "checkbox" onClick = "enableNext ()" /> & Lt; / Body & gt; & Lt; / Html & gt;    

An array is returned to your code and you apply the style to an array are doing. Change it to the code below.

  Enable function next () {Warning ("clicked"); Var s1 = document.getElementsByName ("NextButton") [0]; // Get the first and only button in your case s1.style.visibility = "visible"; }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -