I have a multiple select field where user can select multiple fields. Right now it is taking only the first value of the dropdown.
Here is the jquery code which uses velocity template as front end:
jQuery('select[name="myServices"]').live('change', function(ev) {
var selectedmyServicesOpts = jQuery(this).find(':selected'),
ismyServicesOther=false;
console.log("Getting all selectedvalue" + selectedmyServicesOpts)
if(selectedmyServicesOpts.length > 0) {
jQuery.each(selectedmyServicesOpts, function(index, value) {
if(jQuery(value).val() === 'Other (Text field)') {
jQuery('.myServicesOther').show();
ismyServicesOther=true;
return false;
}
});
}
if (!ismyServicesOther) {
jQuery('.myServicesOther').hide();
}
});