Jump to content

Display textbox on selection from dropdown list ?


plodos

Recommended Posts

Java Script does not work.. What can be the problem ?

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<title>New Page 1</title>

<STYLE TYPE="text/css">
<!--
input{
    display:none;
}
span
{
    display:none;
}
-->
</STYLE>


<script type="text/javascript">
<!--
$(function() {
    $('#sel').change(function() {
        $("input").hide().filter("." + $(this).find("option:selected").val()).show();
    });
    $("input").focus(function() {
        $(this).next("span").fadeIn(1000);
    }).blur(function() {
        $(this).next("span").fadeOut(1000);
    });
});
-->
</script>

</head>

<body>

<form>
    <select id="sel">
        <option value="">- select -</option>
        <option value="option1">Option 1</option>
        <option value="option2">Option 2</option>
        <option value="option3">Option 3</option>
        <option value="option4">Option 4</option>
        <option value="other">Other</option>
    </select>
    
    <input type="text" class="option1" /><span>Textbox label 1</span>
    <input type="text" class="option2" /><span>Textbox label 2</span>
    <input type="text" class="option2" /><span>Textbox label 2</span>
    <input type="text" class="option2" /><span>Textbox label 2</span>
    <input type="text" class="option3" /><span>Textbox label 3</span>
    <input type="text" class="option3" /><span>Textbox label 3</span>
    <input type="text" class="option4" /><span>Textbox label 4</span>
    <input type="text" class="other" /><span>Other</span>
</form>

</body>

</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.