Skip to content
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

chosen doest not work for non dom elements #701

Closed
praneeth22 opened this issue Jun 25, 2012 · 2 comments
Closed

chosen doest not work for non dom elements #701

praneeth22 opened this issue Jun 25, 2012 · 2 comments

Comments

@praneeth22
Copy link

Hi ,

 If you create a dynamic select element like jQuery('<select class="chzn-select"></select>') and then for that call chosen plugin it will not work , 

Possible Solution:

This is happening since in the function set_up_html we are creating container as jQuery('#'+container_id) which searches in dom and fails to find . you can use earliear variable container_div and assign it to container .

@cjlarose
Copy link

I was experiencing the same issue. Your suggested solution was just about perfect; the only problem was that the width of the chosen container element wasn't being calculated appropriately. I've forked and pushed. Check it out. https://github.com/cjlarose/chosen. I'll pull request after I get a more elegant solution to the widths problem.

Also, after you append your element, you must also append the container element. E.g. https://gist.github.com/3021916

@pfiller
Copy link
Contributor

pfiller commented Apr 24, 2013

#1151 has been merged to master and solves this. Grab the latest version.

@pfiller pfiller closed this as completed Apr 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants