vendredi 27 mars 2015

How to get result from select option?

I want to make a select option , where for each option display a different html text on div.



<form>
<label>Select Country:</label>
<select class="country">
<option value="1">United States</option>
<option value="2">India</option>
<option value="3">United Kingdom</option>
</select>
</form>


and jquery .



$("select.country").change(function(){
var selectedCountry = $(".country option:selected").val();
// alert("You have selected the country - " + selectedCountry);
$('#mydiv').prepend('<h2> option one </h2>');
});


How can i achieve this . any idea.


Thanks


Aucun commentaire:

Enregistrer un commentaire