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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.