how to add multiple value using jquery

Posted by Klbaiju under jQuery on 5/8/2014 | Points: 10 | Views : 1919 | Status : [Member] | Replies : 2
Hi,

iam working in a travel related application.in my application .available seats are displayed ina table and each cell having unique id.when i click a cell of available seat,the details are displayed in textboxes including id of the cell.id is set in hiddenfield.it is working fine for set a single value in hidden field.my requirement is i want to add multiple value in hiddenfield.second reqirement is

following working fine for single id

$('#' + hval).parent().empty().append("<a class='anchor3' id ='" + hval + "' href='#' >booked</a>").css('background-color', 'LightGrey');

hval is id of cell

if there is multiple id how to add above code




Responses

Posted by: Ajay.Kalol on: 5/8/2014 [Member] Starter | Points: 25

Up
0
Down
1. You can set multiple value in hidden field by concatenating with last value.
2. And for second one you have to write some logic to make selector string. like if you are saving your ID in hidden field like 1;2;3;4. Then replce ; with ", #" which will produce "1, #2, #3,#4,#5"
Now you can implement selector.
it will like $("#1, #2, #3,#4,#5")

Hope this will help

Ajay
ajaypatelfromsanthal.blogspot.in

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandradev819 on: 5/9/2014 [Member] Starter | Points: 25

Up
0
Down
Hi
for syntax you can check this thread

http://stackoverflow.com/questions/18578270/add-multiple-values-in-input-field-with-jquery

Thanks and Regards
Chandradev
My Blog

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response