-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
How to programmatically set the value? #605
Comments
you need to trigger the |
Just like @stof said: $("#chzn-select").val(value).trigger("liszt:updated"); |
Thanks guys, this worked for me |
Documentation would be nice for that. :) |
It is already documented |
Thank you... |
@thermech why are you talkign about down voting ? Reading the doc would give the uptodate version. As said above, it is documented (it was already documented the first time the question was asked btw) |
Since V1.0 $("#chosen-select").val(value).trigger("chosen:updated"); |
Hi, I tried with version 0.9.7 $("#field-license").val(license).trigger("liszt:updated"); I can see that the value is properly selected if I pull down the list but the label/text does not change Any idea? However I need to use 0.9.7 |
@qlands on 1.0+, it works the same, except that you should trigger |
@qlands Please link to a publicly accessible page (or a Fiddle) that shows the issue so we can attempt to reproduce. Additionally, for support issues or usage questions (like this one) that are not bugs in Chosen itself, please post somewhere like StackOverflow, using the |
I don't know if I have a more recent version of this but the below code works for me
|
No need to add |
@cipster in case of a multiple select, jQuery expects an array for the |
@stof Thank you very much. It works with an array element. |
Hi everyone>> But when i am trying lowercase like jQuery("#wordChosen").val('m'); its not working... how should i add a word like input text by jquery..Please help me.. |
thanks you about multiselect chosen with array. |
Please can anyone help me on postback issues in asp.net. when I am going to select multiple options and click on button, everything is getting deselect and only one option is by default selected after postback. |
@shaggygolvelkar The GitHub issue tracker is intended for bug reports, specific feature requests, and submitting pull requests. For support issues or usage questions like yours, please post somewhere like StackOverflow, using the |
How do I populate the chosen value from controller. I am using multiple chosen select and from the controller when I try to open my form in the edit I am not getting value populated in the drop-down field. |
Please help me... i have chosen drop down list in my page.there is input filed to search.but i have another input filed outside.I want to search in chosen drop down list from the outside input filed like chosen inner input field...please.. |
I don't seem to be able to find much documentation for usage so I'm not sure how to set a chosen dropdown's value?
I tried using jQuery .val() which retrieves the value but doesn't seem to be able set it. If I don't use chosen then this method works fine on an ordinary select dropdown.
E.g.
var value = $("#chzn-select").val(); // Gets the value ok
var value = 1;
$("#chzn-select").val(value); // Doesn't set the value
The text was updated successfully, but these errors were encountered: