erikTsomik
asked on
remove value from the running list using jquery
I have a 2 running list that a stored in the hidden form variable. 1 is to keep selected items another is to keep deleted items. When i click on delete icon i need to remove the item from the first list and add it to the second list. Addition piece is working .
I have a code for deletion but it does not work
var newrID = 'r' + ID;
var list = $('#' + newrID).val();
var index = list.indexOf(ID2);
alert(list);
alert(list.indexOf(bodyID) );
$("#" + newrID).val(list).find(ID2 ).remove() ;
I have a code for deletion but it does not work
var newrID = 'r' + ID;
var list = $('#' + newrID).val();
var index = list.indexOf(ID2);
alert(list);
alert(list.indexOf(bodyID)
$("#" + newrID).val(list).find(ID2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then my code is
$("#" + newrID).val(list.replace(" ,"+ID2,"") );
Or split, loop and delete item then join if array not empty
$("#" + newrID).val(list.replace("
Or split, loop and delete item then join if array not empty
ASKER
var newdID = 'd' + ID;
var curr_relID = $("#" + newdID).val();
curr_relID = curr_relID.split(",");
curr_relID.push(ID2);
$("#" + newdID).val(curr_relID.joi