Javascript - remove part of cookie with a split('|') like array
- by MgS
I'm abit stuck. 
I'm using jQuery.
I have a cookie which has the value such as :
1,something|2,somethingg|1,something
We are treating it as [0] as id and [1] as name.
I need to remove ONE where the id == '1' for example, this will leave the cookie like this:
1,something|2,somethingg
How do I go about this, it will probally be in a loop, but not sure how to remove one of them. I have this so far:
function removeItem(id){ 
var cookieName = 'myCookie';
 var cookie = $.cookie(cookieName);
 if(cookie){
  var cookie = cookie.split('|');
  $(cookie).each(function(index){
   var thisCookieData = this.split(',');
   if(thisCookieData[0] == id ){
   }
  });
}