For the select menu plugin chosen.js, is there an established way to add ‘select all items in list’ or ‘remove all items in list’ feature to a multiple select input? In the main branch or perhaps in one of the forks? Or has someone done this before has some tips?
Share
It should be pretty straight forward, just do it the “normal” way first:
Then trigger the
liszt:updatedevent to update the chosen widget, so the whole thing would look something like this:Update: For those who don’t scroll down and check the other answers, the event is called
chosen:updatedas of a version released in August 2013. Consult the documentation if in doubt.Working demo (js code is at the bottom): http://jsfiddle.net/C7LnL/1/
Tighter version: http://jsfiddle.net/C7LnL/2/
Even tighter version: http://jsfiddle.net/C7LnL/3/