Q:

Remove a specific value from an array using jQuery

0

Remove a specific value from an array using jQuery.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
  <html>
  <head>
  <script src="https://code.jquery.com/jquery-git.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Remove a specific value from an array using jQuery.</title>
  </head>
  <body>
</body>
  </html>

JavaScript Code:

var y = ['Red', 'Green', 'White', 'black', 'Yellow'];
var remove_Item = 'White';

console.log('Array before removing the element = '+y);
y = $.grep(y, function(value) {
  return value != remove_Item;
});
console.log('Array after removing the element = '+y);

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now