jQuery to retrieve and set selected option value of html select element

前端 未结 9 1362
醉梦人生
醉梦人生 2020-11-28 21:15

I am attempting to retrieve and set the selected value of a select element (drop down list) with jQuery.

for retrievel i have tried $(\"#myId\").find(\':select

9条回答
  •  迷失自我
    2020-11-28 21:57

    $("#myId").val() should work if myid is the select element id!

    This would set the selected item: $("#myId").val('VALUE');

提交回复
热议问题