casey
casey

Reputation: 206

Trigger change event when option is selected from select element

My function uses jQuery to select an option from a select element:

$('#id>option:eq(13)').prop("selected",true);

However, this does not trigger the event that is supposed to happen when the user manually selects an option. Is there a way to trigger this event?

Upvotes: 1

Views: 1152

Answers (1)

Manoj
Manoj

Reputation: 1195

yes there is a way. you can trigger events from jquery object.

 $('#id>option:eq(13)').prop("selected",true).trigger('change');

Upvotes: 3

Related Questions