Thursday, 16 April 2015

change drop down event automatically clear in text box

 <select onchange="cleartextbox()">
    <option value="libero">libero</option>
    <option value="Ram">Ram</option>
    </select>
   
    <script type="text/javascript">
    function cleartextbox() {
    document.getElementById("mark").value = "";
    }
    </script>
   
    <label>
    <span>Mark</span>
    <input  type="text" name="mark" id="mark" >
    </label>


Demo

Disable/enable an input using javascript

<script language="javascript">
function codename() {
   

if(document.editpro.checkboxname.checked)
{
document.editpro.name.disabled=false;
document.editpro.city.disabled=false;
document.editpro.mob.disabled=false;
document.editpro.regster.disabled=false;
}
else
{
document.editpro.name.disabled=true;
document.editpro.city.disabled=true;
document.editpro.mob.disabled=true;
document.editpro.regster.disabled=true;
}
}</script>

<form method="post" action="" name="editpro">

<input class="form-control" type="text"  readonly value="" name="email" placeholder="Email">

<input class="form-control" type="text" value="" name="name" disabled="disabled"   placeholder="User Name">

<input disabled="disabled"  class="form-control"id="placepicker" name="city" value=""  type="text" placeholder="City">

<input disabled="disabled"  class="form-control" type="text" name="mob" value="" placeholder="Mobile Number">

 <button type="submit" class="btn  btn-danger" name="regster" disabled="disabled">Submit</button>
 If you Edit Your Info  <input type="checkbox" onclick="codename()" name="checkboxname" value="ON">

</form>


Demo







If you Edit Your Info