How to Remove a Specific Value from an Array Using jQuery ?
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...
- How to Show Loading Spinner in JQuery?
- How to Create Ajax Submit Form Using jQuery?
- How To Get Current Page URL, Path, Host and hash using jQuery?
- How To Get, Set and Delete Div Background Image jQuery?
- JQuery Remove All Unwanted Whitespace From String Example
- Body Background Video Using Vide Jquery Example
- JQuery UI Autocomplete Example
- JQuery Split String By Comma Into Array Example