I am working on a multi-select drop-down menu mentioned below
<select class="form-input name="hideLineItemColumns_quote" multiple="true" ">
<option selected="true" value="part_desc">Description</option>
<option selected="true" value="part_number">Product</option>
<option selected="true" value="costEa_line">Cost</option>
</select>
I want to access values & text of all selected options and use them in further logic. I tried doing this
var tempVar = jQuery("Select[@name='hideLineItemColumns_quote'] option:selected").text();
alert(tempVar[0]);
Instead of showing “Description”, it shows “D”. It combines all three values in one long string. Any ideas what I am doing wrong?
Thanks,
Nitesh
tempVaris a string. So you are looking at the first character in that string which isDIn addition, all you options are selected.
Perhaps this is what you meant to do: