Textbox hiding while dropdown selection

Written by @ 6 March 2013

Textbox hiding while dropdown selection

Code Snippet:

                                                
                                                <!-- this script is provided by www.javascriptfreecode.com coded by: Kerixa Inc. -->
<html>
<head>
<script type="text/javascript">   
function changetextbox()
{

    if (document.getElementById("mfi_4_a_i").value =="No") {
        document.getElementById("sdd").style.display='none';
    } else if (document.getElementById("mfi_4_a_i").value =="Yes")  {
        document.getElementById("sdd").style.background='pink';
    }
else{ 
 document.getElementById("sdd").style.display='block';

}
}
</script>
</head>
<body>
<select id="mfi_4_a_i" name="mfi_4_a_i" onChange="changetextbox();">
    <option>Yes</option>
    <option>No</option>
    <option>No, but planning in future</option>
</select>
<textarea name="mfi_4_a_ii" id="sdd" style="border:1px solid black; width:200px;height;30px;" /></textarea>
</body>
</html><a target='_blank' href='www.javascriptfreecode.com' style='font-size: 8pt; text-decoration: none'>JavaScript Best Codes</a>                                                
                                            

Example:


About @

This user is pending a biography.


Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: Shahmeer, coolcoco7, SmitaPatil25, owoboycute, 092010
advertisement 2