Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Some way of setting value of the selection through JS #608

Closed
septerr opened this Issue · 3 comments

4 participants

@septerr

Say the select box has an id of "foo". Incorporating chose.jquery.js in our existing code base breaks any Javascript that does things like -

${'foo'}.val('1')

or

$('foo').style.display = 'none;' //this we can resolve by enclosing all our select boxes in a span which we can hide instead of the select box itself.

Is there any way you can catch JS calls that modify the select boxes value and accordingly update the awesome drop down that chosen displays?

@stof
Collaborator

There is no event triggered by the browser when setting the value programmatically, which is why Chosen cannot know about the change. The solution is to trigger the liszt:updated event on the select box after changing it (be it because you changed the value or because you changed the options).

$('#foo').val('1').trigger('liszt:updated');
@drcongo

Triggering liszt:updated seems to reset the value of the select though as can be seen in the console here...

http://jsfiddle.net/cfbTD/2/

@pfiller
Owner

I believe this is now fixed in b028f9e. Please pull the latest and re-open if you're seeing the problem still.

@pfiller pfiller closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.