D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
jhnwllr
Full window
Github gist
jquery example multiple select
Built with
blockbuilder.org
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>val demo</title> <style> </style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.bootstrap2.min.css" /> </head> <body> <p></p> <select id="multiple" multiple="multiple"> <option>Dog</option> <option>Cat</option> <option>Turtle</option> </select> <script> function displayVals() { var multipleValues = $( "#multiple" ).val() || []; $( "p" ).html( "Multiple: " + multipleValues.join( ", " ) ); } function printVals() { var logPrint = $( "#multiple" ).val() || []; console.log(logPrint); } $( "select" ).change( printVals ); printVals(); $( "select" ).change( displayVals ); displayVals(); $(function() { $('#multiple').selectize({ delimiter: ',', persist: false, plugins: ['remove_button'], create: function(input) { return { value: input, text: input } } }); }); </script> </body> </html>
https://code.jquery.com/jquery-1.10.2.js