Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Multiple item select box without jQuery dependency Reply To: Multiple item select box without jQuery dependency

#239650
Jerba
Participant

No problem, although it was never meant to be user friendly, I was just trying to demonstrate the basic functionality.

The pen above stores the selected values in an array so you can do what you want with them at that point, pretty much you just need to add a few lines of code to provide the ability to remove a selected item if so required and that’s probably it.

http://codepen.io/Responsive/pen/dMvMLj

“it’s only going to appear on one page so maybe using jQuery plugin is not that bad”

That’s up to you, however, including an entire library for the use of one function seems incredibly overkill, especially considering the functionality you’re referring to would be no more than 50 lines of Javascript if you were to write it yourself.

If you were to use the example I gave you above, then you can simply manipulate the array values as you please and then post the entire array to where ever it needs to go.