问题描述:

I'm having issues using the chosen library.

http://harvesthq.github.io/chosen/

Alright, I looked everywhere. Loading dynamic "chosen" select elements seems to have the solution I'm looking for, but I was wondering if it was possible with just javascript without jQuery (yes I know it's a library, but it's complicated.)

The issue I have is I want to create a select element with Chosen with javascript.

In a .js file I have

var sel = document.createElement("select");

sel.setAttribute( "class" , "chosen" );

Then I attach sel to the page, etc etc.

Point is, it doesn't apply the chosen prettiness. Any help / pointers are appreciated.

Thanks

edit:

after some more searching, I found a solution. This is a repeat of Applying Chosen.js to dynamically created dropdown

相关阅读:
Top