Tuesday, 27 August 2013

JQuery script issue (not working when i click for the second time)

JQuery script issue (not working when i click for the second time)

When i click on the link it will show a pop-up(twitter bootstrap) and in
that i have a select field called country, and i when i select US it will
auto-populate all the states of US in the another select field , else it
will show a text field. It is working when i click link for the first time
, after closing and when i click the link for second time , the script is
not getting loaded. I don't know the reason , Please help me out !
Here is the script :
<script>
$("#job_country").click(function() {
$a = $("#job_country option:selected").text();
if ($a == "United States") {
$("#job_state").show();
$(".text_state").hide();
}
else
{
$("#job_state").hide();
$(".text_state").show();
}
});
});

No comments:

Post a Comment