Select a Multi-select DropDown by values with jquery
By : junfei
Date : March 29 2020, 07:55 AM
may help you . That's because you are overriding previous selected values in each iteration, you should pass an array to the val method, try this:
code : var vals = [];
for (i=0; i<=data[0].fields['sales_item'].length;i++) {
vals.push(data[0].fields['sales_item'][i]);
}
$("#id_deals-sales_item").val(vals);
get values to select in onchange of Multi select box with Jquery
By : Leolan
Date : March 29 2020, 07:55 AM
I hope this helps . trying get values to
onchange of other tag values. I have tow dropdown list called vehicle_type and part_type. what i want to do when select the vehicle type and part type need change the part name dropdown list. It is different to vehicle type and part type combination. So I wrote following code. Could some one help me to find the error of this code. And I'm new to jquery , Try This: code : <?php
if(isset($_POST['vehicle_type'])&&isset($_POST['part_type'])){
$vehicle_type =$_POST['vehicle_type'];
$part_type =$_POST['part_type'];
if(($vehicle_type=="Car")&&($part_type=="Engine")){
$partname = "<option value=\"Engine Head Block\">Engine Head Block</option>";
$partname .= "<option value=\"Engine Complete W/O Gear Box\">Engine Complete W/O Gear Box</option>";
$partname .= "<option value=\"Engine With A/T CVT Gear Box\">Engine With A/T CVT Gear Box</option>";
} elseif(($vehicle_type=="Car")&&($part_type=="Body")){
$partname = "<option value=\"Nose Pannel / Parts\">Nose Pannel / Parts</option>";
$partname .= "<option value=\"Front Bumper With Fog Lamp L/R\">Front Bumper With Fog Lamp L/R</option>";
$partname .= "<option value=\"Front Bumper Bracket Retainer L/R\">Front Bumper Bracket Retainer L/R</option>";
}
echo $partname;
}
?>
<script type="text/javascript">
function setSelect(vehicle_type, part_type){
//alert(vehicle_type+part_type);
$.post("dropdown.php",{"vehicle_type":vehicle_type, "part_type":part_type},function(data){
$("#part_name").html(data);
});
}
$(document).ready(function(){
$("#vehicle_type").change(function(){
var vehicle = $("option:selected",this).val();
});
$("#part_type").change(function(){
var part = $("option:selected",this).val();
setSelect($("#vehicle_type option:selected").val(), $("#part_type option:selected").val());
});
});
</script>
How to get final select values from multi-select drop down list Jquery
By : mosione70
Date : March 29 2020, 07:55 AM
Hope this helps Here you go:
Demo:
JSFiddle code : $("#mySelect").on("change",function(){
var devices = [];
$('#mySelect :selected').each(function(i, selected){
devices[i] = $(selected).text();
//OR
//devices.push($(selected).text());
});
alert(devices);
});
Accessing to multi selected values in 5 filters - SumoSelect - Ajax - JavaScript - JQuery
By : AndroidLover
Date : March 29 2020, 07:55 AM
Does that help According to my best understanding by your question, You want to send multi-selected data to server via ajax calls.
For that first you need to serialize your data. eg. for sending multiple states to server you can do something like
code : state = $('#state').val()
state = JSON.stringify(state)
.....
// send state to server
url = url + "&state=" + state;
...
$state = $_GET['state'];
$states_array = json_decode($state);
var_dump($states_array);
How to reset or unselect multi select box using jQuery?
By : user3298296
Date : March 29 2020, 07:55 AM
will help you You can trigger the click of your reset button and clear the whole div in your document ready function. After this you can remove the class "selected" so its completely reset.
Like this
code : $(document).ready(function() {
$('select').multi({
search_placeholder: 'Search',
});
$('#tabReset').click(function() {
$('.selected-wrapper').empty();
$('a').removeClass('selected');
});
});