Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,
For a selection of a value in combobox ,the text box should visible
For example if value '1' is selected BOX1 should be visible.
if value '2' is selected only BOX2 should be visible.and BOX1
should not be visible.
Thanks
Posted

1 solution

Try the following Code in your HTML :
XML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>

$(document).ready(function(){
    alert("Hi...");
    $("input").hide();

    $("#s").change(function(){
    if($("#s").val() ==  1){
        $("#1").show();
        $("#2").hide();
        $("#3").hide();
    }else if($("#s").val() ==  2){
        $("#2").show();
        $("#1").hide();
        $("#3").hide();
    }else if($("#s").val() == 3){
        $("#3").show();
        $("#1").hide();
        $("#2").hide();
    }else{
        $("input").hide();
    }
    });
});
</script>

<form>
<select id= "s" name = "s">
<option>1</option>
<option>2</option>
<option>3</option>
</select><br><br>
<input type= "text" id="1" name="1" value="1"/><br><br>
<input type= "text" id="2" name="2" value="2"/>
<input type= "text" id="3" name="3" value="3"/>
</select>
</form>


It works....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900