Reputation:
To piggy back off this post jQuery change the select box value based on anchor clicked
I can change the value of the actually select box
$("#id-for-select").val(2)
but not the result of selecting that value (what happens when the value is selected) as if it was clicked by hand
In my case I'm trying to change the dates on a calendar from http://teddevito.com/demos/calendar.php
I'm only able to change the value of the month select box from a anchor but not able to get the corresponding dates for that month since it wasn't actually clicked from the drop down.
Any way I can keep the dates corresponding with the month value in the select box?
Upvotes: 0
Views: 470
Reputation: 16955
Try adding a .trigger('change') on the end of your .val():
$("#id-for-select").val(2).trigger('change')
Upvotes: 1