How to add or remove specifc value from array using jQuery

Originally posted on 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;…