Javascript examples for jQuery:String
Javascript splice string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.4.js"></script> <script type="text/javascript"> $(window).load(function(){/* ww w . ja va2 s . co m*/ var my_array = ["apples","pears","bananas","oranges"]; var pos = $.inArray("pears", my_array); pos !== -1 && my_array.splice(pos, 1); $.each(my_array, function(k,v) { document.write(v+"<br>"); }); }); </script> </head> <body> </body> </html>