<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jquery array &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/jquery-array/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 21 Aug 2015 06:50:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>jquery array &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Merge Multiple Arrays To One</title>
		<link>https://www.sibeeshpassion.com/merge-multiple-arrays-to-one/</link>
					<comments>https://www.sibeeshpassion.com/merge-multiple-arrays-to-one/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 18 Aug 2015 12:06:45 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery array]]></category>
		<category><![CDATA[jquery functions]]></category>
		<category><![CDATA[Merge Multiple Arrays To One]]></category>
		<category><![CDATA[Merge Multiple Arrays To One Without Using Loop]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=9791</guid>

					<description><![CDATA[In this post we will discuss how we can merge multiple arrays to one array using JQuery. There are so many ways to achieve this. Like we can loop through each array and push it to other array one by one or we can join those arrays one by one. Or we can use JQuery function merge() . But requirement was bit different. Since I was using large data, I was not able to use any loop or any long processes. We will discuss an easy way here in this article. I hope you will like this. Background Recently I [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can merge multiple arrays to one array using <a href="http://sibeeshpassion.com/tag/jquery/" target="_blank">JQuery</a>. There are so many ways to achieve this. Like we can loop through each array and push it to other array one by one or we can join those arrays one by one. Or we can use <a href="http://sibeeshpassion.com/tag/jquery-functions/" target="_blank">JQuery function</a> <em>merge() </em>. But requirement was bit different. Since  I was using large data, I was not able to use any loop or any long processes. We will discuss an easy way here in this article. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>Recently I got a requirement of merging large collections of client side arrays to one array. The problem was the arrays were dynamic, hence I was not sure about the count of those arrays, it may be different in different times. So what to do? A loop, merge, push, join in jquery was not a perfect solution for me since the data was large. So I found the solution in other way. </p>
<p><strong>Using the code</strong></p>
<p>Consider we have some arrays as follows.</p>
<p>[js]<br />
[21,2], [35,4], [25,6],[11,6],[44,67]<br />
[/js]</p>
<p>Now we need to change these arrays to a variable.</p>
<p>[js]<br />
var myArrays = [[21,2], [35,4], [25,6],[11,6],[44,67]];<br />
[/js]</p>
<p>Now here comes the real part.</p>
<p>[js]<br />
var myArray = [].concat.apply([], myArrays);<br />
[/js]</p>
<p>We are using <em>jquery concat</em> and <em>jquery apply()</em> function.</p>
<p>Now we will write this array to console.</p>
<p>[js]<br />
console.log(myArray);<br />
[/js]</p>
<p>See the console, you can get the values as follows.</p>
<div id="attachment_9801" style="width: 549px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-9801" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png" alt="Merge Multiple Arrays To One" width="539" height="270" class="size-full wp-image-9801" srcset="/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png 539w, /wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One-300x150.png 300w, /wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One-400x200.png 400w" sizes="(max-width: 539px) 100vw, 539px" /></a><p id="caption-attachment-9801" class="wp-caption-text">Merge Multiple Arrays To One</p></div>
<p>You can see the demo at jsfiddle here: <a href="http://jsfiddle.net/sibeeshvenu/xyhc28jt/" target="_blank">Merge Multiple Arrays To One</a></p>
<p><strong>Conclusion</strong></p>
<p>I hope someone found it useful. Please share me your valuable suggestions and feedback. Thanks in advance.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/merge-multiple-arrays-to-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Remove An Array Element By Index</title>
		<link>https://www.sibeeshpassion.com/remove-an-array-element-by-index/</link>
					<comments>https://www.sibeeshpassion.com/remove-an-array-element-by-index/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 07 Aug 2015 00:30:03 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery array]]></category>
		<category><![CDATA[jquery splice]]></category>
		<category><![CDATA[Remove An Array Element By Index]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=8161</guid>

					<description><![CDATA[In this article, we will see how we can remove an array element by index. We all work with client side array right? What will you do if you need to remove an array element?It will be easy for you to do, if you know the index of the element which we need to delete from the array. Here we are going to discuss that. We will give an option to select the index, and will take that value, and then we will delete the array. Simple right?I hope you will like this article. Using the code Create some elements [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article, we will see how we can remove an array element by index. We all work with client side array right? What will you do if you need to remove an array element?It will be easy for you to do, if you know the index of the element which we need to delete from the array. Here we are going to discuss that. We will give an option to select the index, and will take that value, and then we will delete the array. Simple right?I hope you will like this article. </p>
<p><strong>Using the code</strong></p>
<p><strong>Create some elements</strong></p>
<p>[html]<br />
&lt;button id=&quot;loadAndShow&quot;&gt;Load Array And Show&lt;/button&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;div id=&quot;divloadAndShow&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;input type=&quot;number&quot; id=&quot;number&quot; /&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;button id=&quot;RemoveAndShow&quot;&gt;Remove And Show&lt;/button&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;div id=&quot;divRemoveAndShow&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;<br />
[/html]</p>
<p><em>Add CSS</em></p>
<p>[css]<br />
 &lt;style&gt;<br />
        div {<br />
            display: none;<br />
        }<br />
    &lt;/style&gt;<br />
[/css]</p>
<p><strong>Add the scripts</strong></p>
<p>[js]<br />
    &lt;script&gt;<br />
        var myJSON = [];<br />
        function removeArrayElementByIndex(myArray, index) {<br />
            myArray.splice(index, 1);<br />
            $(&#8216;#divRemoveAndShow&#8217;).html(&#8216;Removed from Array and JSON string is  &#8216;).append(JSON.stringify(myArray)).show();<br />
            myJSON = myArray<br />
        }<br />
        $(function () {<br />
            $(&#8216;#RemoveAndShow&#8217;).hide();<br />
            $(&#8216;#number&#8217;).hide();<br />
            $(&#8216;#loadAndShow&#8217;).click(function () {<br />
                $(&#8216;#RemoveAndShow&#8217;).show();<br />
                $(&#8216;#number&#8217;).show().val(0);<br />
                $(&#8216;#divloadAndShow&#8217;).html(&#8216;Loaded to Array and JSON string is  &#8216;).append(&#8216;[{ &quot;name&quot;: &quot;2014&quot;, &quot;level&quot;: 1 }, { &quot;name&quot;: &quot;4&quot;, &quot;level&quot;: 2 }, { &quot;name&quot;: &quot;12&quot;, &quot;level&quot;: 3 }]&#8217;).show();<br />
                myJSON = $.parseJSON(&#8216;[{ &quot;name&quot;: &quot;2014&quot;, &quot;level&quot;: 1 }, { &quot;name&quot;: &quot;4&quot;, &quot;level&quot;: 2 }, { &quot;name&quot;: &quot;12&quot;, &quot;level&quot;: 3 }]&#8217;);<br />
            });<br />
            $(&#8216;#RemoveAndShow&#8217;).click(function () {<br />
                removeArrayElementByIndex(myJSON, $(&#8216;#number&#8217;).val());<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>In the above code you can find out a function <em>removeArrayElementByIndex</em> which accepts our array and the index as arguments. </p>
<p>[js]<br />
 function removeArrayElementByIndex(myArray, index) {<br />
            myArray.splice(index, 1);<br />
            $(&#8216;#divRemoveAndShow&#8217;).html(&#8216;Removed from Array and JSON string is  &#8216;).append(JSON.stringify(myArray)).show();<br />
            myJSON = myArray<br />
        }<br />
[/js]</p>
<p>When you click on the button <em>loadAndShow</em> , we will load the array and shows the contents. </p>
<p>[js]<br />
//This is the data we load<br />
[{ &quot;name&quot;: &quot;2014&quot;, &quot;level&quot;: 1 }, { &quot;name&quot;: &quot;4&quot;, &quot;level&quot;: 2 }, { &quot;name&quot;: &quot;12&quot;, &quot;level&quot;: 3 }]<br />
[/js]</p>
<p>And if you click on the button <em>RemoveAndShow</em> we will delete the array by passing the array and index to the function  <em>removeArrayElementByIndex</em> </p>
<p><strong>Complete code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Remove an array element by its index&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;style&gt;<br />
        div {<br />
            display: none;<br />
        }<br />
    &lt;/style&gt;<br />
    &lt;script&gt;<br />
        var myJSON = [];<br />
        function removeArrayElementByIndex(myArray, index) {<br />
            myArray.splice(index, 1);<br />
            $(&#8216;#divRemoveAndShow&#8217;).html(&#8216;Removed from Array and JSON string is  &#8216;).append(JSON.stringify(myArray)).show();<br />
            myJSON = myArray<br />
        }<br />
        $(function () {<br />
            $(&#8216;#RemoveAndShow&#8217;).hide();<br />
            $(&#8216;#number&#8217;).hide();<br />
            $(&#8216;#loadAndShow&#8217;).click(function () {<br />
                $(&#8216;#RemoveAndShow&#8217;).show();<br />
                $(&#8216;#number&#8217;).show().val(0);<br />
                $(&#8216;#divloadAndShow&#8217;).html(&#8216;Loaded to Array and JSON string is  &#8216;).append(&#8216;[{ &quot;name&quot;: &quot;2014&quot;, &quot;level&quot;: 1 }, { &quot;name&quot;: &quot;4&quot;, &quot;level&quot;: 2 }, { &quot;name&quot;: &quot;12&quot;, &quot;level&quot;: 3 }]&#8217;).show();<br />
                myJSON = $.parseJSON(&#8216;[{ &quot;name&quot;: &quot;2014&quot;, &quot;level&quot;: 1 }, { &quot;name&quot;: &quot;4&quot;, &quot;level&quot;: 2 }, { &quot;name&quot;: &quot;12&quot;, &quot;level&quot;: 3 }]&#8217;);<br />
            });<br />
            $(&#8216;#RemoveAndShow&#8217;).click(function () {<br />
                removeArrayElementByIndex(myJSON, $(&#8216;#number&#8217;).val());<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;button id=&quot;loadAndShow&quot;&gt;Load Array And Show&lt;/button&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;div id=&quot;divloadAndShow&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;input type=&quot;number&quot; id=&quot;number&quot; /&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;button id=&quot;RemoveAndShow&quot;&gt;Remove And Show&lt;/button&gt;&lt;br /&gt;&lt;br /&gt;<br />
    &lt;div id=&quot;divRemoveAndShow&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<div id="attachment_8211" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index.png"><img decoding="async" aria-describedby="caption-attachment-8211" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index-300x86.png" alt="Remove an array element by its index" width="300" height="86" class="size-medium wp-image-8211" srcset="/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index-300x86.png 300w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index-400x115.png 400w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index.png 510w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-8211" class="wp-caption-text">Remove an array element by its index</p></div>
<div id="attachment_8221" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1.png"><img decoding="async" aria-describedby="caption-attachment-8221" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1-300x88.png" alt="Remove an array element by its index" width="300" height="88" class="size-medium wp-image-8221" srcset="/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1-300x88.png 300w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1-768x226.png 768w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1-400x118.png 400w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index1.png 871w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-8221" class="wp-caption-text">Remove an array element by its index</p></div>
<div id="attachment_8222" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2.png"><img decoding="async" aria-describedby="caption-attachment-8222" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2-300x109.png" alt="Remove an array element by its index" width="300" height="109" class="size-medium wp-image-8222" srcset="/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2-300x109.png 300w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2-768x279.png 768w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2-400x146.png 400w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index2.png 852w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-8222" class="wp-caption-text">Remove an array element by its index</p></div>
<div id="attachment_8231" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3.png"><img decoding="async" aria-describedby="caption-attachment-8231" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3-300x101.png" alt="Remove an array element by its index" width="300" height="101" class="size-medium wp-image-8231" srcset="/wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3-300x101.png 300w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3-768x260.png 768w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3-400x135.png 400w, /wp-content/uploads/2015/07/Remove_Array_Elements_By_Index3.png 828w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-8231" class="wp-caption-text">Remove an array element by its index</p></div>
<p><strong>Conclusion</strong></p>
<p>I hope someone found it is useful. Please share me your feedback. Thanks in advance.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/remove-an-array-element-by-index/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find And Exclude Element From Array</title>
		<link>https://www.sibeeshpassion.com/find-and-exclude-element-from-array/</link>
					<comments>https://www.sibeeshpassion.com/find-and-exclude-element-from-array/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 05 Aug 2015 00:50:47 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[exclude elements]]></category>
		<category><![CDATA[jquery array]]></category>
		<category><![CDATA[JQuery Click]]></category>
		<category><![CDATA[jquery functions]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=7772</guid>

					<description><![CDATA[In this post we well discuss about finding and excluding element from JQuery Array. We all worked in a JQuery. Sometimes we works in JQuery Arrays too. Right? Consider we have an array, and in that array we need to exclude a particular element and create a new array without excluded element. What we will do? We will use a for loop and just loop through the array,apply some conditions and if a criteria matches, we will do some operation right? Here I am going to share you an another way that we can achieve this by using a function [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we well discuss about finding and excluding element from JQuery Array. We all worked in a JQuery. Sometimes we works in JQuery Arrays too. Right? Consider we have an array, and in that array we need to exclude a particular element and create a new array without excluded element. What we will do? We will use a for loop and just loop through the array,apply some conditions and if a criteria matches, we will do some operation right? Here I am going to share you an another way that we can achieve this by using a function called <em>grep</em> in JQuery. Normally <em>grep</em> function act as <em>each</em> in JQuery. </p>
<p><strong>Backgroud</strong></p>
<p>I am working in a client side application where there are lots of client side arrays and variables. We handle our entire client side processes by using JQuery. I usually go through the operation of finding and removing array elements using JQuery. I thought it would be better if I share some knowledge about that here. I hope someone will find it is useful.</p>
<p><strong>Using the code</strong></p>
<p>To start with you need to include jquery reference.</p>
<p>[js]<br />
 &lt;script src=&quot;https://code.jquery.com/jquery-2.1.4.min.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Now we need an array right? Consider following is our array.</p>
<p>[js]<br />
var myArray = [&#8216;Monday&#8217;,&#8217;Tuesday&#8217;,&#8217;Wednesday&#8217;,&#8217;Thursday&#8217;,&#8217;Friday&#8217;,&#8217;Saturday&#8217;,&#8217;Sunday&#8217;]<br />
[/js]</p>
<p>Next, we will formulate this array to a HTML table, so that the visualization will be perfect. To do this we will have a function, which will just convert the array element to HTML table. Following is our function body.</p>
<p>[js]<br />
 function buildTable(array,message){<br />
	      var html='&lt;table&gt;&lt;caption&gt;&#8217;+message+'&lt;/caption&gt;&lt;tr&gt;&#8217;;<br />
		  for(var i=0;i&lt;array.length;i++)<br />
		  {<br />
			html+='&lt;td&gt;&#8217;+array[i]+'&lt;/td&gt;&#8217;;<br />
		  }<br />
		  html+='&lt;/tr&gt;&lt;/table&gt;&#8217;;<br />
		  $(&quot;#body&quot;).html(html);<br />
	   }<br />
[/js]	 </p>
<p>As you can see, the parameters for this functions are, an array and a caption message.<br />
Now we need to call this unction right?	 </p>
<p>[js]<br />
 var myArray = [&#8216;Monday&#8217;,&#8217;Tuesday&#8217;,&#8217;Wednesday&#8217;,&#8217;Thursday&#8217;,&#8217;Friday&#8217;,&#8217;Saturday&#8217;,&#8217;Sunday&#8217;]<br />
			var message=&quot;My Array Elements Before Removing&quot;;<br />
			buildTable(myArray,message);<br />
[/js]	 	</p>
<p>Style out HTML table by giving the preceding styles.	 </p>
<p>[css]<br />
 &lt;style&gt;<br />
		  tr{<br />
		     border:1px solid #ccc;<br />
		  }<br />
		  td{<br />
			 border:1px solid #ccc;<br />
			 padding: 10px;<br />
		  }<br />
		  #body{<br />
		    margin: 30px;<br />
		  }<br />
		  #click{<br />
		    margin: 30px;<br />
			cursor:pointer;<br />
		  }</p>
<p>      &lt;/style&gt;<br />
[/css]	 	 </p>
<p>So our output will be as follows. 	</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array-300x48.png" alt="Exclude_or_remove_array_element_from_array" width="300" height="48" class="alignnone size-medium wp-image-7782" srcset="/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array-300x48.png 300w, /wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array-400x64.png 400w, /wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array.png 597w" sizes="(max-width: 300px) 100vw, 300px" /></a>	</p>
<p>Now we need to fire a click event in which we will find out which element is to be excluded from the array, and finally assign new element set to our existing array. 	</p>
<p>[html]<br />
&lt;a hrefe=&quot;#&quot; id=&quot;click&quot;&gt;Click To Remove&lt;/a&gt;<br />
[/html]	 	 </p>
<p>[js]<br />
$(&quot;#click&quot;).click(function(){<br />
				var message=&quot;My Array Elements After Removing&quot;;<br />
				var excludedElement = [&#8216;Thursday&#8217;];<br />
				myArray = jQuery.grep(myArray, function(value) {<br />
				return value != excludedElement;<br />
			    });<br />
			    buildTable(myArray,message);<br />
			});<br />
[/js]	 </p>
<p>Here we are finding the element <em>&#8216;Thursday&#8217;</em> which we saved to a variable as follows.</p>
<p>[js]<br />
var excludedElement = [&#8216;Thursday&#8217;];<br />
[/js]	 	</p>
<p>Now our real here is <em>jQuery.grep</em> , which returns our new array with filtered data.</p>
<p>[js]<br />
return value != excludedElement;<br />
[/js]	 </p>
<p>And then we are calling our <em>buildTable</em> function to formulate our new array to a HTML table. Once we call it we will get an output as follows.	 	</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array_after.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array_after-300x60.png" alt="Exclude_or_remove_array_element_from_array_after" width="300" height="60" class="alignnone size-medium wp-image-7792" srcset="/wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array_after-300x60.png 300w, /wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array_after-400x81.png 400w, /wp-content/uploads/2015/07/Exclude_or_remove_array_element_from_array_after.png 501w" sizes="(max-width: 300px) 100vw, 300px" /></a>	 </p>
<p><strong>Complete Code</strong>	 	</p>
<p>[html]<br />
&lt;html&gt;<br />
   &lt;head&gt;<br />
      &lt;title&gt;Remove Elements From An Array using JQuery- Sibeesh Passion&lt;/title&gt;<br />
      &lt;style&gt;<br />
		  tr{<br />
		     border:1px solid #ccc;<br />
		  }<br />
		  td{<br />
			 border:1px solid #ccc;<br />
			 padding: 10px;<br />
		  }<br />
		  #body{<br />
		    margin: 30px;<br />
		  }<br />
		  #click{<br />
		    margin: 30px;<br />
			cursor:pointer;<br />
		  }</p>
<p>      &lt;/style&gt;<br />
      &lt;script src=&quot;https://code.jquery.com/jquery-2.1.4.min.js&quot;&gt;&lt;/script&gt;<br />
   &lt;/head&gt;<br />
   &lt;body&gt;<br />
   &lt;a hrefe=&quot;#&quot; id=&quot;click&quot;&gt;Click To Remove&lt;/a&gt;<br />
   &lt;div id=&quot;body&quot;&gt;&lt;/div&gt;<br />
      &lt;script&gt;<br />
       $(document).ready(function(){<br />
		    var myArray = [&#8216;Monday&#8217;,&#8217;Tuesday&#8217;,&#8217;Wednesday&#8217;,&#8217;Thursday&#8217;,&#8217;Friday&#8217;,&#8217;Saturday&#8217;,&#8217;Sunday&#8217;]<br />
			var message=&quot;My Array Elements Before Removing&quot;;<br />
			buildTable(myArray,message);</p>
<p>			$(&quot;#click&quot;).click(function(){<br />
				var message=&quot;My Array Elements After Removing&quot;;<br />
				var excludedElement = [&#8216;Thursday&#8217;];<br />
				myArray = jQuery.grep(myArray, function(value) {<br />
				return value != excludedElement;<br />
			    });<br />
			    buildTable(myArray,message);<br />
			});<br />
	   });<br />
	   function buildTable(array,message){<br />
	      var html='&lt;table&gt;&lt;caption&gt;&#8217;+message+'&lt;/caption&gt;&lt;tr&gt;&#8217;;<br />
		  for(var i=0;i&lt;array.length;i++)<br />
		  {<br />
			html+='&lt;td&gt;&#8217;+array[i]+'&lt;/td&gt;&#8217;;<br />
		  }<br />
		  html+='&lt;/tr&gt;&lt;/table&gt;&#8217;;<br />
		  $(&quot;#body&quot;).html(html);<br />
	   }<br />
      &lt;/script&gt;</p>
<p>   &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]	 </p>
<p><strong>Demo</strong></p>
<p>Please find out the demo in jsfiddle here: <a href="http://jsfiddle.net/sibeeshvenu/099odrbq/" target="_blank">Exclude or remove elements</a></p>
<p><strong>Conclusion</strong>	</p>
<p>I hope you liked this article. Please share me your feedback. It is always welcomed. Thanks in advance.	 </p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/find-and-exclude-element-from-array/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
