0

I have a HTML drop down. The data source for the drop down is a dictionary. The selected values key will be stored in a hidden field. On page reload i want to set the value in the dictionary as a selected value of drop down. The dictionary key will be stored in hidden field.

var IxCustomer = $(_this.IxCustomerHiddenFieldId).val();

$(_this.CustomerSelectId).find("option[value=" + IxCustomer  + "]").attr("selected", true);

How can i modify this.

4

1 回答 1

1

这应该这样做:

$(_this.CustomerSelectId).val(IxCustomer);

设置<select>元素的值会选择相应的选项。

于 2013-07-23T04:48:55.533 回答