Show Hide TextBox When CheckBox Is Checked Unchecked Using JavaScript

Show Hide TextBox When CheckBox Is Checked Unchecked Using JavaScript

Here we show  how you can show and hide TextBox when CheckBox is checked  and unchecked  using JavaScript.

Here the CheckBox has been assigned a JavaScript OnClick event handler. When the CheckBox is clicked, the showHide() JavaScript function is executed. Inside this function, based on whether CheckBox is checked or unchecked , the TextBox is show or hide.

Below is example code.

				
					<!DOCTYPE html>
    <head>
        <title>inflay.com | Show Hide TextBox When CheckBox Is Checked Unchecked Using JavaScript</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    </head>
    <body>
          <h3>Show Hide TextBox When CheckBox Is Checked Unchecked Using JavaScript</h3>
          <br />
                  <input type = "checkbox" id="check" name="check" onclick="showHide()">
                  <input type = "text" name="name" id="name" value="" placeholder="Enter name" style="display:none">
    </body>
</html>
				
			

I hope this article helps you.
Thanks for visiting Inflay.com .