Reputation: 880
I found this jQuery code which is easy to use, but I can't find a way to get the selected value. I am using Control 7, and would like to have a button beside that onClick
show the values there are selected in the multi-dropdown.
http://labs.abeautifulsite.net/projects/js/jquery/multiSelect/demo/
Upvotes: 2
Views: 6335
Reputation: 1498
You should just be able to do this:
$("#idofinputfield").val()
and it will return you an array that you could loop over.
Upvotes: 1
Reputation: 32598
You can select the checkboxes in the div next to the element you are interested in and map their values to an array:
var values = $("#control_7").next().find(":checked").map( function() { return this.value; });
Upvotes: 2
Reputation: 1071
You can select inputs that are checked using the :checked
selector. Check out the jQuery documentation.
Here is a more complete answer:
var valueOfSelected = $('input:checked').attr('name');
$('showNextToInput').html('valueOfSelected');
Wrap that in a function and use it in the callback method (like example 6 in the demo you provided).
Upvotes: 0