i have been trying to find a way to incorporate 2 values into a multiple select list. i have tryed to achieve this by using the first value as part of the text string and then utilizing a second value in the value string. This is to achieve a set discount on certain items when added to a shopping basket. My output page should show: 1. list of items @RRP 2. total@rrp 3. items at discount 4. total@ discount. 5.saving on purchases.
Here is a sample of the code for addition:
function b() {
var summaryb = “”;
//multiple select list: get selected items as array
$(‘select[name=”list1″] :selected’).each(
function (i, selected) {
summaryb += Number(parseInt($(selected).txt()));
});
$(‘#m1-test_2-textArea2’).text(summaryb);
yet even when recognizing the numerical elements of text Jquery cannot seem to perform numerical tasks with them. Therefore my questions:
1. is it possible to code it this way
2. is there any other way to have “2 values ” for a select list item
3. could an ID selector be used (i have no idea how to do this though)
I apologize if this is already covered elsewhere but i could not find answers in the forums here or stack overflow.
Thanks