-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct way to select an option from JS ? #236
Comments
If you are using the jQuery wrapper, Native equivelent: If you absolutely need to select an element by it's text value, then you can use the search function in conjunction with the select function. var dk = Dropkick('#myselect');
var matches = dk.search('value1');
matches && dk.select(matches[0]); |
Thank you, Wil! The 'text value' is the best way because it's close to how .val() works in jQuery. I don't know if DropKick can listen to change() event of the select - if yes, an ideal implementation would look like - $('#myselect').val('value1') Yes, no DropKick in this line. DropKick would listen to the change() and then update its current value automatically. |
Agreed. The next update will most likely include a listener on the select to update the Dropkick. For now, I'm going to leave this issue open and get this implemented later in the week. |
Can't listen to
|
Hi all,
simple $('#myselect').val('value1') won't work if #myselect is wrapped with DropKick.
Strange but $('#myselect').val('value1').dropkick('refresh') won't work also.
What is the correct way to change selected value?
The text was updated successfully, but these errors were encountered: