dzm
dzm

Reputation: 23564

jQuery SelectMenu - Re-initilize causes double drop downs

I'm using this plugin: http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html

I have some places where I'm using ajax that makes use of this as well as non-ajax elements on the same page. After I load the ajax, I re-initiate the function '.selectmenu', so the elements being loaded through ajax will be applied.

This causes the other elements on the page to now have double drop down menus, each time it's re-initiated, it adds another menu.

Any ideas how I can fix this? Maybe clear it out, then re-initialize or something?

Upvotes: 2

Views: 504

Answers (1)

Matt Ball
Matt Ball

Reputation: 359966

Just don't select elements which have already been initialized by the plugin. It looks like the selectmenu plugin hides <selects> which it has jazzed up, so selecting by visibility should work:

$('select.selectmenu:visible').selectmenu({...});

Upvotes: 2

Related Questions