Skip to main content
added 296 characters in body; edited title
Source Link
David
  • 8.7k
  • 7
  • 52
  • 71

hide Hide and show a text field using javascript

i am a beginer to javascript.I want to show a hidden textbox on a button click.i do the bellow code.but, but it doesnt work.What

What is the problem with my code.?

<!DOCTYPE html> <html>  <head> <script> <script type="text/javascript">  function display()   {  var z=promptz = prompt("enter your name...");  if(z !=null= null)   {  document.getElementById("demo").innerHTML="thankyouinnerHTML "+z+"= "thankyou " + z + "..";  document.getElementById("case").style.visibility='visible';visibility = 'visible';  }   else {  document.getElementById("demo").innerHTML="thankyou";innerHTML = "thankyou"; }  }  </script>  <title></title> </head>  <body>  <p id="demo">clickid="demo">  click on the button..... </p> <buttonp><button type="button" onclick="display()">submit</button>  <form> <input type="text" id="case" name="myText" style="display:none"> </form>  </body> </html>  

hide and show a text field using javascript

i am a beginer to javascript.I want to show a hidden textbox on a button click.i do the bellow code.but it doesnt work.What is the problem with my code.

<!DOCTYPE html> <html> <head> <script> function display()  { var z=prompt("enter your name..."); if(z!=null)  { document.getElementById("demo").innerHTML="thankyou "+z+".."; document.getElementById("case").style.visibility='visible'; }  else document.getElementById("demo").innerHTML="thankyou"; } </script> </head> <body> <p id="demo">click on the button.....</p> <button type="button" onclick="display()">submit</button> <input type="text" id="case" name="myText" style="display:none"> </body> </html>  

Hide and show a text field

i am a beginer to javascript.I want to show a hidden textbox on a button click.i do the bellow code, but it doesnt work.

What is the problem with my code?

<!DOCTYPE html> <html>  <head>  <script type="text/javascript">  function display() {  var z = prompt("enter your name...");  if(z != null) {  document.getElementById("demo").innerHTML = "thankyou " + z + "..";  document.getElementById("case").style.visibility = 'visible';  } else {  document.getElementById("demo").innerHTML = "thankyou"; }  }  </script>  <title></title> </head>  <body>  <p id="demo">  click on the button..... </p><button type="button" onclick="display()">submit</button>  <form> <input type="text" id="case" name="myText" style="display:none"> </form>  </body> </html> 
Source Link
DjangoDev
  • 957
  • 7
  • 16
  • 25

hide and show a text field using javascript

i am a beginer to javascript.I want to show a hidden textbox on a button click.i do the bellow code.but it doesnt work.What is the problem with my code.

<!DOCTYPE html> <html> <head> <script> function display() { var z=prompt("enter your name..."); if(z!=null) { document.getElementById("demo").innerHTML="thankyou "+z+".."; document.getElementById("case").style.visibility='visible'; } else document.getElementById("demo").innerHTML="thankyou"; } </script> </head> <body> <p id="demo">click on the button.....</p> <button type="button" onclick="display()">submit</button> <input type="text" id="case" name="myText" style="display:none"> </body> </html>