47
rated 0 times
[
50]
[
3]
/ answers: 1 / hits: 9225
/ 4 Years ago, tue, january 7, 2020, 12:00:00
I have created a select2 dropdown with
<select class=form-control select2 id=country>
<option value=1>India</option>
<option value=2>Aus</option>
<option value=3>usa</option>
</select>
Now i am selecting selected value via jquery trigger event
$('#country').val('1').trigger('change');
here, country gets selected with passed value but On this event i also want to trigger change event which is not triggering.
$(#country).change(function() {
alert('on country change');
});
If i change manually from select2 then the change event fires and it shows the alert but i want to fire the change event automatically when the country value changes from jquery. Any clues?
Thanks in advance.
More From » jquery