Pages

Wednesday, May 16, 2012

removing a item from array in javascript


// This function is to remove items from a list
Array.prototype.removeItems = function (s) {
    var i = $.inArray(s, this);
    while (i != -1) {
        this.splice(i, 1);
        i = $.inArray(s, this);
    }
}

---- now u can use removeItems method in javascript for any array

No comments:

Post a Comment