Trigger change event <select> using jquery

前端 未结 8 1145
别那么骄傲
别那么骄傲 2020-11-28 04:27

is there anyway i could trigger a change event on select box on page load and select a particular option.

Also the function executed by adding the trigger after bin

8条回答
  •  独厮守ぢ
    2020-11-28 05:01

    To select an option, use .val('value-of-the-option') on the select element. To trigger the change element, use .change() or .trigger('change').

    The problems in your code are the comma instead of the dot in $('.check'),trigger('change'); and the fact that you call it before binding the event handler.

提交回复
热议问题