How to Remove a Specific Value from an Array Using jQuery ?

20-May-2021

.

Admin

Hi Guys,

In this example,I will learn you how to remove a specific value from an array using jquery.you can easy and simply remove a specific value from an array using jquery.

Here i will give simple and easy example for how to remove a specific value from an array using jquery. We will show jquery remove perticuler value from array.

Example:


<!DOCTYPE html>

<html>

<head>

<title>How to Remove Array Element in Jquery by Value? - Nicesnippets.com</title>

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>

</head>

<body>

<script type="text/javascript">

var array = ["red", "white", "orange", "black","green"];

var removeItem = "orange";

var arrayNew = $.grep(array, function(value) {

return value != removeItem;

});

console.log(arrayNew);

</script>

</body>

</html>

Output:

[ "red", "white", "black", "green" ]

It will help you...

#Jquery