Set the selected index of a Dropdown using jQuery

后端 未结 10 816
离开以前
离开以前 2020-11-30 17:49

How do I set the index of a dropdown in jQuery if the way I\'m finding the control is as follows:

$(\"*[id$=\'\" + originalId + \"\']\") 

I

10条回答
  •  无人及你
    2020-11-30 18:45

    You want to grab the value of the first option in the select element.

    $("*[id$='" + originalId + "']").val($("*[id$='" + originalId + "'] option:first").attr('value'));
    

提交回复
热议问题