Trigger click on select box on hover

后端 未结 6 1375
孤独总比滥情好
孤独总比滥情好 2020-11-30 13:10

I\'m trying to have a select box automatically pop open when the use hovers over it, as if they had clicked it. Is this possible?

I would think I could

6条回答
  •  执笔经年
    2020-11-30 13:23

    Unfortunately the method with Chosen - did not work for me.

    But I thought I could make my own selector on jQuery.

    HTML:

    Select option

    JS:

    $('.hidden p').click(function(){
      $(this).closest('.select').find('.input').text($(this).text());
      $(this).closest('.select').find('input').val($(this).attr('value'));
      $(this).closest('.select').trigger("change");
    });
    
    $('.select').change(function(){
      // ... do stuff
    });
    

    https://codepen.io/qwer643/pen/LebKpo

提交回复
热议问题