Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Comments

Projects
None yet
3 participants

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 .

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

Contributor

pfiller commented Apr 24, 2013

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

@pfiller pfiller closed this Apr 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment