How do I change selected value of select2 dropdown with JqGrid?

后端 未结 16 934
遥遥无期
遥遥无期 2020-11-27 10:27

I\'m using Oleg\'s select2 demo, but I am wondering whether it would be possible to change the currently selected value in the dropdown menu.

For example, if the fou

16条回答
  •  抹茶落季
    2020-11-27 11:02

    you can simply use the get/set method for set the value

    $("#select").select2("val"); //get the value
    $("#select").select2("val", "CA"); //set the value
    

    or you can do this:

    $('#select').val("E").change(); // you must enter the Value instead of the string
    

提交回复
热议问题