我想根据我拥有的值通过 jquery 更改下拉选项。并根据该值显示文本有
html:-
<select id="OfferType">
<option value="Unspecified" selected="selected">Unspecified</option>
<option value="FreeOffer">Free Offer</option>
<option value="LowOffer">Low Offer</option>
<option value="AddOffer">Add Offer</option>
<option value="PercentageOffer">Percentage Offer</option>
<option value="GroupOffer">Group Offer</option>
</select>
在jQuery中
if (('filterby' in urlParams) && (urlParams['filterby'] == 'LowOffer')) {
$("#OfferType").val("LowOffer");
$('#OfferType option[value=LowOffer]').text('Low Offer');
submitAjaxOffersSearch();
}
数据根据val("LowOffer")排序,但在下拉文本中不是 Show text("LowOffer");