<select id="placeSelect" onchange="map_place_change();" >
<option value="CN">China</option>
<option value="WORD">world</option>
</select>
when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ?
thanks ?
<select id="placeSelect" onchange="map_place_change();" >
<option value="CN">China</option>
<option value="WORD">world</option>
</select>
when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ?
thanks ?
you need to use following code:
function map_place_change(){
var value = $(this).val(); // value = "CN"
var text = $(this).find("option:selected").text();// China
}
$('#placeSelect').change(function(){
alert($('#placeSelect option:selected').html());
});
your function would be something like:
function map_place_change(){
alert($('#placeSelect option:selected').html());
}