triying to do a combo select with this.val() but it doesnt show the second select

Posted by irenkai on Stack Overflow See other posts from Stack Overflow or by irenkai
Published on 2010-04-11T02:12:38Z Indexed on 2010/04/11 2:23 UTC
Read the original article Hit count: 326

Filed under:
|
|

Im triying to do a combo where the when the user selects Chile out of the select box, a second select shows up showing the cities. The jQuery code Im using is this.

$(document).ready(function(){var ciudad = $("#ciudad");
ciudad.css("display","none");
$("select#selectionpais").change(function(){
    var hearValue = $("select#selectionpais").val();
    if( hearValue == "chile"){
        ciudad.css("display","block");

; }else{ ciudad.css("display","none") } });
});

and the Html is this (abreviated for the sake of understanding)

   <select name="pais" id="selectionpais">

.... Chile Afganistán

and the second select (the one that should be shown is this)

  <select id="ciudad" name="ciudad" class="ciudad">

Santiago

Anyone has a clue why it isnt working?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about select