This is one of the simple javascript and most important in forms, so here i'm going to help you how to make this kind of onselect input text field adding using javascript. this one is very helpful to you.
SCRPIT
<script type="text/javascript"> function mstatus(val){ var element=document.getElementById('martialid'); if(val=='1'||val=='married') element.style.display='block'; else element.style.display='none'; } </script>
HTML CODE
<form name="formname" method="post" action=""> <label for="martialstatus"> Marital status <span class="semicols">:</span> </label> <select name="maritalstatus" required="required" onchange='mstatus(this.value);' > <option value=""> Marital Status </option> <option value="single"> Single </option> <option value="married"> Married </option> <option value="other"> Others </option> </select> <div id="martialid" style='display:none;'> <label for="anniversary"> Anniversary <span class="semicols">:</span> </label> <input type="date" placeholder="MM/DD/YEAR" name="anniversary" /> </div> </form>
i hope this post may helpful to you. Thank you.
kolhapuri misal pav recipe | kolhapuri misal pav | how to make misal pav | instant misal pav recipe | misal recipe
ReplyDelete