How to add or remove specifc value from array using jQuery


ThinkToApply

var y =[1,2,2,3,2]var removeItem =2;

y = jQuery.grep(y,function(value){return value != removeItem;});
F.Y.R. http://stackoverflow.com/questions/3596089/how-to-remove-specifc-value-from-array-using-jquery

 if ($(SenderID).attr("src") == "TurnJS/images/add_ref_icon_gray.png") {
 $(SenderID).attr("src", "TurnJS/images/add_ref_icon_red.png");
 ReferenceBookPageList.push(parseInt($(SenderID).attr("page-no")));
 }
 else {
 $(SenderID).attr("src", "TurnJS/images/add_ref_icon_gray.png");
 var removeItem = parseInt($(SenderID).attr("page-no"));
 ReferenceBookPageList = jQuery.grep(ReferenceBookPageList, function (value) {
 return value != removeItem;
 });
 }

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s