Click event on select option element in chrome

前端 未结 13 952
闹比i
闹比i 2020-11-22 11:38

I\'m having a problem in Chrome with the following:

var items = $(\"option\", obj);  

items.each(function(){

    $(this).click(function(){

           


        
13条回答
  •  粉色の甜心
    2020-11-22 11:53

    The easy way to change the select, and update it is this.

    // BY id
    $('#select_element_selector').val('value').change();
    

    another example:

    //By tag
    $('[name=selectxD]').val('value').change();
    

    another example:

    $("#select_element_selector").val('value').trigger('chosen:updated');
    

提交回复
热议问题