Show/Hide Div in Form based on selected option using javascript

Hi Friends,

I am going to write a script to Show/hide div contents using Javascript and HTML.

In this article, I will write codes and you can check it on your localhost/web page.

	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="Owner" />

	<title>Untitled 1</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">

    if( $(this).val()==="other"){


    <label for="db">Choose type</label>
<select name="dbType" id="dbType">
   <option>Choose Database Type</option>
   <option value="oracle">Oracle</option>
   <option value="mssql">MS SQL</option>
   <option value="mysql">MySQL</option>
   <option value="other">Other</option>

<div id="otherType" style="display:none;">
<label for="specify">Specify</label>
<input type="text" name="specify" placeholder="Specify Databse Type"/>


Leave a Reply

Your email address will not be published. Required fields are marked *