<select id="facetList" style="width:120px;" class="text ui-widget-content ui-corner-all">
<?php
foreach($claAddArray as $k => $v)
{
echo "<option value=\"$k\">$v</option>";
}
?>
</select>
$("#btnSubmit").click(function() {
var $fId = ?????????????????
});
<select id="facetList" style="width:120px;" class="text ui-widget-content ui-corner-all">
<?php
foreach($claAddArray as $k => $v)
{
echo "<option value=\"$k\">$v</option>";
}
?>
</select>
$("#btnSubmit").click(function() {
var $fId = ?????????????????
});
Share
Improve this question
edited Dec 22, 2010 at 12:55
Shakti Singh
86.4k21 gold badges139 silver badges155 bronze badges
asked Dec 22, 2010 at 12:50
Ahmad FaridAhmad Farid
14.8k45 gold badges98 silver badges138 bronze badges
2 Answers
Reset to default 9jQuery's .val() will return the currently selected option's value if run on the select list itself. In your case $("#facetList").val();
use $("#facetList option:selected").text();
for the text of the option tag.
document.getElementById('facetList').options[document.getElementById('facetList').selectedIndex].value