I know its simple solution,sorry for asking,but cant figure out it myself.
<div class="form-group">
<label for="sort"><?php _e('Sort', 'bootstrapwp'); ?><span class="help-required">*</span></label>
<select name="sort" id="sort" class="selectpicker show-menu-arrow form-control required sort" multiple title="Vali sort..."role="select" aria-required="true" multiple data-max-options="10">
<optgroup label="Varajased">
<option>Honeoye</option>
<option>Rumba</option>
<option>Lambada</option>
<option>Darselect</option>
</optgroup>
</select>
</div>
my multiselect form looks like above,and i want to get selected values from there displayed after last single value,which is $suhtluskeel\n\n:
$body = "Eesnimi: $eesnimi\n\n Perekonnanimi: $perekonnanimi\n\n E-mail: $email\n\n Kontakttelefon: $phone\n\n Aadress: $aadress\n\n Suhtluskeel: $suhtluskeel\n\n";
how can i add this code i found
$('#multiselect1').multiselect({
...
onChange: function() {
console.log($('#multiselect1').val());
}
});
You just need to wrap your multi-select code inside $(document).ready
function -
$(document).ready(function() {
$('#multiselect1').multiselect({
onChange: function() {
console.log($('#multiselect1').val());
}
});
});
Also there is an alternative if you face any problem with your code.
$(document).ready(function() {
$('#multiselect1').multiselect({
onChange: function(option, checked, select) {
console.log('Changed option ' + $(option).val() + '.');
}
});
});