<?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 &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/jquery-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Sat, 10 Nov 2012 17:04:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>jQuery Google &#124; jQuery Google Latest &#8211; Include latest jQuery from Google/jQuery CDN</title>
		<link>https://theextremewebdesigns.com/blog/jquery-google-jquery-google-latest-include-latest-jquery-from-google/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-google-jquery-google-latest-include-latest-jquery-from-google/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 10 Nov 2012 17:04:49 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1487</guid>

					<description><![CDATA[If you always wondered what jQuery Google latest is but didn&#8217;t know what it really means, then this article is for you. In this article, I am going to tell you  what jQuery Google latest is, why I recommended using it &#38; how it can be used to ease up your web development process and how [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you always wondered what <strong>jQuery Google latest</strong> is but didn&#8217;t know what it really means, then this article is for you. In this article, I am going to tell you  what jQuery Google latest is, why I recommended using it &amp; how it can be used to ease up your web development process and how to make your website pages load faster. You can follow the instructions and implement the once and for all (permanently) without having to keep switching to a latest version of jQuery, whenever one is released. In short, you can use the code provided in this article, include it in your website once &amp; it will always include the <strong>latest minified version of jQuery from Google automatically</strong>. Excited? Read on to find out more.</p>
<p><span id="more-1487"></span></p>
<h2>jQuery Google Latest | Google jQuery Hosting &#8211; Always Include latest jQuery from Google/jQuery CDN</h2>
<p>If you already know about the intro about jQuery hosted on Google and would like to skip to the code directly, then simply <a title="Always include latest version of jQuery from Google" href="#latest_jquery_from_google" class="broken_link">click here</a>. Or if you would like to read an intro about it and the advantages of always including the latest jQuery from Google, then continue to read on.</p>
<p>jQuery, as you know is an awesome JavaScript framework (If you would like to know more about jQuery, then read my article on <a title="What is jQuery? Why jQuery? How to use jQuery?" href="https://theextremewebdesigns.com/blog/what-is-jquery-why-to-use-jquery-how-to-use-jquery/" target="_blank">What jQuery is, why to use jQuery and how to use jQuery</a>). When developing websites, you may have noticed that jQuery releases periodical updates that can be really helpful as they fix bugs (if any), add new features, deprecate any older functions, etc. So you might come around a tutorial on the internet that shows you how to do things the new way by including the latest jQuery in their demo/scripts. And if you do implement those tutorials in your website and try to run it then you ultimately risk breaking that specific (new) functionality on your website. You may be wondering that you are using the exact same code but still you cant figure out what&#8217;s wrong and why the script is not working. After hours (or even days) of struggling with it, you may eventually realize that you forgot to include the latest version of jQuery! So is there any way to fix this automatically without having you to manually update is to the Google latest jQuery version? Fortunately, there is!</p>
<p>Enter &#8220;<strong>Hosting latest version of jQuery from Google/jQuery CDN</strong>&#8220;! Instead of including the jQuery script from your local files, you can now can just make including latest jQuery from jQuery CDN, always &amp; automatically it or from Google hosted servers (with minor changes to script tag)! I am going to give a quick definition of CDN (as I am going to be using that word quite few times through this article) &amp; then I will talk about some of the advantages of including <strong>Google jQuery hosting</strong>, followed by the actual code.</p>
<h3>Quick Definition of CDN:</h3>
<p><strong>A CDN stands for Content Delivery Network</strong>. This network focus on distributing your static content across servers in various, diverse physical locations. That said, when a browser resolves the URL for these files that are included in the webpage (such as javascript), the script will be downloaded/made available from  the closest available server in the network.</p>
<p><strong>Advantages of always including latest version of jQuery from Google/jQuery CDN</strong></p>
<ul>
<li><strong>No manual update required &#8211; </strong>Once you implement the code provided in this article, you no longer will have to update to the newest version of jQuery, whenever one becomes available. The newer version of jQuery is automatically included for you. So this decreases maintenance &amp; increases your productivity. This is true if you choose to include jQuery from jQuery CDN. But if you include it from Google CDN, you will have to update the script name again.</li>
<li><strong>Access to the latest additions &#8211;</strong> You can always take advantage of the latest features without having to worry about including the latest jQuery version. Simply go ahead &amp; make your changes &amp; that&#8217;s it! Again, this is true in case of including jQuery from jQuery CDN. In case of Google CDN, you will have to make sure that you have updated the script URL to take advantage of the newest version.</li>
<li><strong>Parallel Download/Parallelism &#8211;</strong> Usually the web browsers limit the number of connections that can be made simultaneously, to avoid overloading servers unnecessarily. So depending on the browser that is being used at that point of time, you may be limited to as low as two connections per hostname. So if you opt to use jQuery/Google AJAX Libraries, CDN eliminates one request to your site, allowing more of your local content to downloaded in parallel. It may not seem like a huge difference if the browser allows multiple concurrent connections, but for users who are running a browser that allows minimum concurrent connection, the difference can be noticed.</li>
<li><strong>Decreased latency &#8211;</strong>When the latest version of jQuery is included from jQuery/Google’s AJAX Libraries CDN, the browsers of users who are located physically away from your server, will be able to download jQuery faster from jQuery/Google&#8217;s servers. So this will reduce the time their browser spends on fetching the copy of jQuery. So if your website is focused on targeting only a specific region of the globe and you are absolutely certain that your audience reach may never go beyond your targeted region &amp; if your webserver is located in the same place as your consumers, then you may opt to include a copy of jQuery on your servers.<br />
If this is not the case and you have visitors all over the globe, then including jQuery from jQuery/Google&#8217;s AJAX Libraries CDN will fasten up browsing experience for users who are away from your web server&#8217;s physical location. And the best part is that using jQuery/Google&#8217;s CDN is free! So it be a worthy move to include jQuery from jQuery/Google&#8217;s library.</li>
<li><strong>Caching &#8211;</strong> The biggest advantage of including jQuery from Google CDN or jQuery CDN is that your website users may not need to download jQuery at all. The browsers will be able to download it once from the CDN and they will be able to use this cached copy. And this speeds up browsing speed tremendously.</li>
</ul>
<p><a name="latest_jquery_from_google"></a></p>
<h2> How to always include latest jQuery version from Google for any website.</h2>
<p>Well ok, so here&#8217;s the part that you were waiting for.</p>
<h3>Code to always include latest jQuery from jQuery CDN in a regular website:</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;</pre>
<h3>Code to always include latest jQuery from Google CDN in a regular website:</h3>
<pre class="lang:js decode:true">//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js</pre>
<p>In the above code, make sure that you <strong>don&#8217;t</strong> include http: in front of //ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js. It is intentionally made that way as it allows you to use a single reference that works on both HTTP and HTTPS pages. You may use http: in front of it, if you are not using a web server altogether i.e. when you might be working on HTML pages &amp; including jQuery in it. So if you are working on a website that needs a web server, such as PHP, WordPress, Joomla, etc. you can safely omit using http:</p>
<h3>Code to always include latest jQuery from Microsoft CDN in a regular website:</h3>
<pre class="lang:js decode:true">http://ajax.microsoft.com/ajax/jquery/jquery-1.8.2.min.js</pre>
<h3>Code to always include latest jQuery from jQuery CDN in a WordPress theme/website:</h3>
<pre class="lang:php decode:true">&lt;?php
function my_jquery_enqueue()
{
	//If any jQuery is already included, deregister it
	wp_deregister_script('jquery');

	//Register our jQuery from jQuery hosted servers
	wp_register_script('jquery', 'http://code.jquery.com/jquery-latest.min.js', false, null);

	//Enqueue the latest version of jQuery registered in the above step, to be used in the website
	wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'my_jquery_enqueue');
?&gt;</pre>
<h3>Code to always include latest jQuery from Google CDN in a WordPress theme/website:</h3>
<p>[php]</p>
<p>&lt;?php</p>
<p>function my_jquery_enqueue()<br />
{<br />
//If any jQuery is already included, deregister it<br />
wp_deregister_script(&#8216;jquery&#8217;);</p>
<p>//Register our jQuery from Google hosted servers<br />
wp_register_script(&#8216;jquery&#8217;, &#8216;//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js&#8217;, false, null);</p>
<p>//Enqueue the latest version of jQuery registered in the above step, to be used in the website<br />
wp_enqueue_script(&#8216;jquery&#8217;);<br />
}<br />
add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;my_jquery_enqueue&#8217;);<br />
?&gt;</p>
<p>[/php]</p>
<h3>Code to always include latest jQuery from Microsoft CDN in a WordPress theme/website:</h3>
<pre class="lang:php decode:true">&lt;?php
function my_jquery_enqueue()
{
	//If any jQuery is already included, deregister it
	wp_deregister_script('jquery');

	//Register our jQuery from Microsoft hosted servers
	wp_register_script('jquery', 'http://ajax.microsoft.com/ajax/jquery/jquery-1.8.2.min.js', false, null);

	//Enqueue the latest version of jQuery registered in the above step, to be used in the website
	wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'my_jquery_enqueue');
?&gt;</pre>
<h2>jQuery CDN vs Google CDN vs Microsoft CDN for jQuery:</h2>
<p>You might be wondering which option to go with, for choosing to host your jQuery file with. Here&#8217;s what I recommend:</p>
<p><strong>jQuery CDN &#8211;</strong> There&#8217;s no maintenance required for it, whatsoever. It&#8217;s automatically updated, thereby providing you all new features without having to mess with the script tag tweak.</p>
<p><strong>Google CDN &#8211;</strong> If you have no issues in changing the script tag manually each time jQuery is updated &amp; you would like to use Google to host it as they have broader coverage than jQuery CDN.</p>
<p><strong>Microsoft CDN &#8211;</strong> If you are a Microsoft fan!</p>
<p>There are some other differences but they are not important if you just need to include latest version of jQuery.</p>
<p><strong>That&#8217;s it for this article!</strong></p>
<p>Do you know of any other ways to use <strong>latest version of jQuery from Google/jQuery/Microsoft CDN</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-google-jquery-google-latest-include-latest-jquery-from-google/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1487</post-id>	</item>
		<item>
		<title>jQuery CSS Method Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-css-jquery-css-method-jquery-css-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-css-jquery-css-method-jquery-css-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 10 Nov 2012 14:16:13 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1477</guid>

					<description><![CDATA[jQuery CSS is an easy to use method available in jQuery for accessing the style property from the first matched element, in the set of matched elements. Simply put, if you need to assign a new value via CSS, modify an existing CSS value or need to remove the existing CSS values using jQuery, then jQuery [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>jQuery CSS</strong></em> is an easy to use <strong>method</strong> available in jQuery for accessing the style property from the first matched element, in the set of matched elements. Simply put, if you need to assign a new value via CSS, modify an existing CSS value or need to remove the existing CSS values using jQuery, then <strong>jQuery .css(); method</strong> is for you. In this article, I am going to share with you easy ways of using the<strong> .css() method</strong> along with relevant examples. Read on to find out more info.<span id="more-1477"></span></p>
<h2>How to use .css() Method in jQuery &#8211; Examples</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1477" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>In order to see how to use the <em><strong>.css() method in jQuery</strong></em>, let us consider that we have a div and we are going to apply our CSS styles to it. Lets see by means of a simple example, how to do this in different ways. But first, feel free to try the demo. Following the demo, will be the source code followed by specific examples.</p>
<h3>Using .css() method in jQuery to access and manipulate the styles of an element</h3>
<p><strong>Here&#8217;s the HTML + basic jQuery required to get started with our examples:<br />
</strong>(Please note that jQuery v.&gt;= 1.7 is required to run the demo using .on() method in jQuery)</p>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery .css(); Method Examples&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.red {
border: 1px solid #FF0000;
margin: 10px;
}
.green {
background-color: #CEFFCE;
margin: 10px;
}

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="divs_container"&gt;

&lt;div id="mydiv1" class="red"&gt;
This is my 1 div

&lt;/div&gt;

&lt;/div&gt;

&lt;input type="button" name="sbt_get_class" id="sbt_get_class" value="Get Class"&gt;

&lt;input type="button" name="sbt_set_class" id="sbt_set_class" value="Set/ReplaceWith Green Class"&gt;

&lt;input type="button" name="sbt_remove_class" id="sbt_remove_class" value="Remove Class"&gt;

&lt;br&gt;
&lt;input type="button" name="sbt_add_red_class" id="sbt_add_red_class" value="Add Red Class"&gt;

&lt;input type="button" name="sbt_add_green_class" id="sbt_add_green_class" value="Add Green Class with Red Class"&gt;

&lt;input type="button" name="sbt_remove_red_class" id="sbt_remove_red_class" value="Remove Red Class"&gt;

&lt;br&gt;

&lt;input type="button" name="sbt_add_purple_bg" id="sbt_add_purple_bg" value="Add Purple Background"&gt;

&lt;input type="button" name="sbt_add_multiple_css" id="sbt_add_multiple_css" value="Add Multiple CSS"&gt;

&lt;input type="button" name="sbt_chain_css_styles" id="sbt_chain_css_styles" value="Chain CSS styles"&gt;

&lt;br&gt;

&lt;input type="button" name="sbt_reset" id="sbt_reset" value="Reset everything"&gt;
&lt;script type="text/javascript" language="javascript"&gt;

$(document).ready(function(){

var divs_container_html = $(".divs_container").html();

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Following is the jQuery code for the examples:</p>
<h3>Example #1 &#8211; Alert the current class of the div using the .css() method in jQuery</h3>
<pre class="lang:js decode:true">$('#sbt_get_class').on("click", function(){

alert( $('#mydiv1').attr('class') );

});</pre>
<h3>Example #2 &#8211; Assign/Set/Replace Class for a div using the .css() method in jQuery</h3>
<pre class="lang:js decode:true">$('#sbt_set_class').on("click", function(){

$('#mydiv1').attr('class', 'green');

});</pre>
<h3>Examples #3 &#8211; Remove existing/all classes of a div using the .css() method</h3>
<pre class="lang:js decode:true">$('#sbt_remove_class').on("click", function(){

$('#mydiv1').removeClass();

});</pre>
<h3>Example #4 &#8211; Add a single class to a div using the jQuery .css() method</h3>
<pre class="lang:js decode:true">$('#sbt_add_red_class').on("click", function(){

$('#mydiv1').attr('class', 'red');

});</pre>
<h3>Example #5 &#8211; Append a single new class to an existing class of a div using css() method</h3>
<pre class="lang:js decode:true">$('#sbt_add_green_class').on("click", function(){

$('#mydiv1').addClass('green');

});</pre>
<h3>Example #6 &#8211; Remove a specific single class from a list of all applied classes using .css() method in jQuery</h3>
<pre class="lang:js decode:true">$('#sbt_remove_red_class').on("click", function(){

$('#mydiv1').removeClass('red');

});</pre>
<h3>Example #7 &#8211; Add Class by specifying CSS style directly using jQuery CSS</h3>
<pre class="lang:js decode:true">$('#sbt_add_purple_bg').on("click", function(){

$('#mydiv1').css("background-color","purple");

});</pre>
<h3>Example #8 &#8211; Add new css styles using the .css() method in jQuery (If any of the style is already present on the target div, it will be overwritten with the new style).</h3>
<pre class="lang:js decode:true">$('#sbt_add_multiple_css').on("click", function(){

$('#mydiv1').css({"background-color":"#CEFFCE", "font-size":"20px", "font-color":"#000", "font-weight":"bold"});

});</pre>
<h3>Example #9 &#8211; Add CSS styles via &#8220;chaining&#8221; using .css() method of jQuery</h3>
<pre class="lang:js decode:true">$('#sbt_chain_css_styles').on("click", function(){

$('#mydiv1').css("background-color", "#0099FF")
.css("font-size", "40px")
.css("font-color", "#FFF")
.css("font-weight", "normal")
.css("border", "10px solid #06C");

});</pre>
<h3>Example #10 &#8211; Reset the divs back to their original state using the .css() method</h3>
<pre class="lang:js decode:true">$('#sbt_reset').on("click", function(){

$(".divs_container").html(divs_container_html);

});</pre>
<p>Easy so far? You can build up on the other CSS properties using the methodology as described above.</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1477" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it for this article!</h5>
<p>Do you know of any other ways to use the <em><strong>jQuery css method</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-css-jquery-css-method-jquery-css-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1477</post-id>	</item>
		<item>
		<title>jQuery insertAfter Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-insertafter-using-insertafter-in-jquery-insertafter-method-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-insertafter-using-insertafter-in-jquery-insertafter-method-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 10 Nov 2012 06:01:29 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1470</guid>

					<description><![CDATA[jQuery insertAfter is an easy to use method provided by jQuery. If you want to insert text or any other content, insertAfter the end of an element, then insertAfter method is for you. In this article, I am going to share info on the insertAfter() method along with easy to follow examples. How to use [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>jQuery insertAfter</strong></em> is an easy to use method provided by jQuery. If you want to insert text or any other content, insertAfter the end of an element, then <strong>insertAfter method</strong> is for you. In this article, I am going to share info on the insertAfter() method along with easy to follow examples.<span id="more-1470"></span></p>
<h2>How to use the jQuery insertAfter() method</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1470" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s consider an example. This example assumes that we have few divs with class applied to each of them &amp; these divs are held in another &#8220;container&#8221; div for easy manipulation. So what we are going to do is have an individual button that will let you add content insertAfter the red and orange div. We also have another button that will reset the div back to their original state, once the jquery insertAfter method has been used on them dynamically.</p>
<h3>Example: Here is the complete source code that shows how to use the insertAfter method in jQuery</h3>
<pre class="lang:xhtml decode:true crayon-selected" title="Using .insertAfter() method in JQuery">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery .insertAfter() method Examples&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.red {
background-color: #FFA6A6;
border: 1px solid red;
margin: 10px;
}
.green {
background-color: #CEFFCE;
border: 1px solid green;
margin: 10px;
}
.grey {
background-color: #EEEEEE;
border: 1px solid #CCC;
margin: 10px;
}
.orange {
background-color: #FF9900;
border: 1px solid #F60;
margin: 10px;
}
.blue {
background-color: #0099FF;
border: 1px solid #06C;
margin: 10px;
}
.purple {
background-color: #9966FF;
border: 1px solid #90F;
margin: 10px;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="divs_container"&gt;

&lt;div id="mydiv1" class="red"&gt;
This is my 1 div

&lt;div id="mydiv2" class="green"&gt;
This is my 2 div
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="mydiv3" class="grey"&gt;
This is my 3 div
&lt;/div&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;div id="mydiv4" class="orange"&gt;
This is my 4 div

&lt;div id="mydiv5" class="blue"&gt;
This is my 5 div
&lt;/div&gt;

&lt;div id="mydiv6" class="purple"&gt;
This is my 6 div
&lt;/div&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;input type="button" name="sbt_insertAfter_green" id="sbt_insertAfter_green" value="Add Grey Div insertAfter Green"&gt;

&lt;input type="submit" name="sbt_remove" id="sbt_remove" value="Undo"&gt;

&lt;input type="button" name="sbt_insertAfter_orange" id="sbt_insertAfter_orange" value="Add Purple Div insertAfter Orange"&gt;
&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

var divs_container_html = $(".divs_container").html();

//Add Gray Div after Green
$('#sbt_insertAfter_green').on("click", function(){

$('.green').insertAfter($('.grey'));

});

//Add Orange Div after Purple
$('#sbt_insertAfter_orange').on("click", function(){

$('.orange').insertAfter($('.purple'));

});

//Reset the divs back to their original state
$('#sbt_remove').on("click", function(){

$(".divs_container").html(divs_container_html);

});

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1470" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h2>Difference between jquery .after() and jquery .insertAfter()</h2>
<p>In jQuery, the .after() and .insertAfter() methods have the same functioanlity. However, the main difference lies in the syntax. To be more precise, the syntax varies, in the placement of the content and target. Here&#8217;s an easy represenatation for your understanding:</p>
<h3>Using jQuery .after();</h3>
<pre class="lang:js decode:true">$('target_selector').after(new_content);</pre>
<h3>Using jQuery .insertAfter();</h3>
<pre class="lang:js decode:true">$('new_content').insertAfter('target_selector');</pre>
<p>Where the new_content can be a div, an image, HTML content, etc. If you would like a technical explanation of the above, here it is:</p>
<p>When .after() is used, the target selector appears <strong>before</strong> the method and the new content appears <strong>after</strong> the method.</p>
<p>When .insertAfter() is used, the target selector appears <strong>after</strong> the method and the new content appears <strong>before</strong> the method.</p>
<p>Hope that explains it!</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1470" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it for now!</h5>
<p>Do you know of any other ways to use <em><strong>.insertAfter() method using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-insertafter-using-insertafter-in-jquery-insertafter-method-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1470</post-id>	</item>
		<item>
		<title>jQuery after Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-after-using-after-in-jquery-after-method-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-after-using-after-in-jquery-after-method-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 10 Nov 2012 04:28:39 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1463</guid>

					<description><![CDATA[jQuery after is an easy to use method provided by jQuery. If you want to insert text or any other content, after the end of an element, then .after() method is for you. In this article, I am going to share info on the after() method along with easy to follow examples. How to use [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>jQuery after</strong></em> is an easy to use method provided by jQuery. If you want to insert text or any other content, after the end of an element, then .<strong>after() method</strong> is for you. In this article, I am going to share info on the after() method along with easy to follow examples.<span id="more-1463"></span></p>
<h2>How to use the jQuery after() method</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1463" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s consider an example. This example assumes that we have few divs with class applied to each of them &amp; these divs are held in another &#8220;container&#8221; div for easy manipulation. So what we are going to do is have an individual button that will let you add content after the red and orange div. We also have another button that will reset the div back to their original state, once the jquery after method has been used on them dynamically.</p>
<h3>Example: Here is the complete source code to use the .after() method in jQuery</h3>
<pre class="lang:xhtml decode:true crayon-selected" title="jQuery after Examples">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery .after() method Examples&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.red {
background-color: #FFA6A6;
border: 1px solid red;
margin: 10px;
}
.green {
background-color: #CEFFCE;
border: 1px solid green;
margin: 10px;
}
.grey {
background-color: #EEEEEE;
border: 1px solid #CCC;
margin: 10px;
}
.orange {
background-color: #FF9900;
border: 1px solid #F60;
margin: 10px;
}
.blue {
background-color: #0099FF;
border: 1px solid #06C;
margin: 10px;
}
.purple {
background-color: #9966FF;
border: 1px solid #90F;
margin: 10px;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="divs_container"&gt;

&lt;div id="mydiv1" class="red"&gt;
This is my 1 div

&lt;div id="mydiv2" class="green"&gt;
This is my 2 div
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="mydiv3" class="grey"&gt;
This is my 3 div
&lt;/div&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;div id="mydiv4" class="orange"&gt;
This is my 4 div

&lt;div id="mydiv5" class="blue"&gt;
This is my 5 div
&lt;/div&gt;

&lt;div id="mydiv6" class="purple"&gt;
This is my 6 div
&lt;/div&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;input type="button" name="sbt_after_green" id="sbt_after_green" value="Add Grey Div after Green"&gt;

&lt;input type="submit" name="sbt_remove" id="sbt_remove" value="Undo"&gt;

&lt;input type="button" name="sbt_after_orange" id="sbt_after_orange" value="Add Purple Div after Orange"&gt;

&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

var divs_container_html = $(".divs_container").html();

//Add Grey Div after Green
$('#sbt_after_green').on("click", function(){

$('.green').after($('.grey'));

});

//Add Purple Div after Orange div
$('#sbt_after_orange').on("click", function(){

$('.orange').after($('.purple'));

});

//Reset the divs back to their original state
$('#sbt_remove').on("click", function(){

$(".divs_container").html(divs_container_html);

});

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1463" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it for now!</h5>
<p>Do you know of any other ways to use <strong>.after() method using jQuery</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-after-using-after-in-jquery-after-method-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1463</post-id>	</item>
		<item>
		<title>jQuery appendTo Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-appendto-using-appendto-in-jquery-appendto-method-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-appendto-using-appendto-in-jquery-appendto-method-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 06 Nov 2012 10:13:32 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1456</guid>

					<description><![CDATA[Using jQuery appendTo method, you can easily add content, dynamic or static. This is immensely helpful with inserting dynamic content in a div or any other element. In this article, I am going to share info on the appendTo() method along with easy to follow examples. How to use jQuery appendTo method Here&#8217;s a simple [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Using <em><strong>jQuery appendTo method</strong></em>, you can easily add content, dynamic or static. This is immensely helpful with inserting dynamic content in a div or any other element. In this article, I am going to share info on the appendTo() method along with easy to follow examples.<span id="more-1456"></span></p>
<h2>How to use jQuery appendTo method</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1456" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Here&#8217;s a simple example to use the <strong>appendTo() method</strong>. This example assumes that we have 2 main divs with class &#8220;red&#8221; &amp; &#8220;green&#8221; applied to them &amp; these divs are held in another &#8220;container&#8221; div for easy manipulation. So what we are going to do is have 2 individual buttons that will let you appendTo the red div to green div and vice-versa. We also have another button that will reset the divs back to their original state, once the jquery appendTo method has been used on them dynamically.</p>
<h3>Example for .appendTo() method:</h3>
<p>Here is the complete source code:</p>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jjQuer .appendTo() method Examples&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.red {
background-color: #FFA6A6;
border: 1px solid red;
margin: 10px;
}
.green {
background-color: #CEFFCE;
border: 1px solid green;
margin: 10px;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="divs_container"&gt;

&lt;div id="mydiv1" class="red"&gt;This is my 1 div&lt;/div&gt;

&lt;div id="mydiv2" class="green"&gt;This is my 2 div&lt;/div&gt;

&lt;/div&gt;

&lt;input type="button" name="sbt_append_g2r" id="sbt_append_g2r" value="Append Green Div to Red"&gt;
&lt;input type="submit" name="sbt_remove" id="sbt_remove" value="Unappend/Remove"&gt;
&lt;input type="button" name="sbt_append_r2g" id="sbt_append_r2g" value="Append Red Div to Green"&gt;

&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

var divs_container_html = $(".divs_container").html();

//Append Green Div to Red
$('#sbt_append_g2r').on("click", function(){

$('.green').appendTo($('.red'));

});

//Append Red Div to Green
$('#sbt_append_r2g').on("click", function(){

$('.red').appendTo($('.green'));

});

//Reset the divs back to their original state
$('#sbt_remove').on("click", function(){

$(".divs_container").html(divs_container_html);

});

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1456" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h2>Difference between jquery .append() and jquery .appendTo()</h2>
<p>In jQuery, the .append() and .appendTo() methods have the same functioanlity. However, <strong>the main difference lies in the syntax</strong>. To be more precise, the syntax varies, in the placement of the content and target. Here&#8217;s an easy represenatation for your understanding:</p>
<h3>Using .append();</h3>
<pre class="lang:js decode:true">$(target).append(new_content);</pre>
<h3>Using .appendTo();</h3>
<pre class="lang:js decode:true">$(new_content).appendTo(target);</pre>
<p>Where the new_content can be a div, an image, HTML content, etc. If you would like a technical explanation of the above, here it is:</p>
<p>When .append() is used, the container into which the content is inserted appears <strong>before</strong> the method.</p>
<p>When .appendTo() is used, the container into which the content is inserted appears <strong>after </strong>the method.</p>
<p><strong>That&#8217;s it for now!</strong></p>
<p>Do you know of any other ways to use <strong>.appendTo() method using jQuery</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-appendto-using-appendto-in-jquery-appendto-method-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1456</post-id>	</item>
		<item>
		<title>jQuery append Method Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-append-using-append-in-jquery-append-method-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-append-using-append-in-jquery-append-method-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 06 Nov 2012 08:51:07 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1445</guid>

					<description><![CDATA[If you ever wanted to insert content, text or html or both, after the content of the matched elements but did not know how to do it, then you can use the  jQuery append method. Using it, you can easily add content, dynamic or static. In this article, I am going to share info on the append() [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you ever wanted to insert content, text or html or both, after the content of the matched elements but did not know how to do it, then you can use the <em><strong> jQuery append method</strong></em>. Using it, you can easily add content, dynamic or static. In this article, I am going to share info on the append() method along with easy to follow examples.<span id="more-1445"></span></p>
<h2>How to use jQuery append method</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1445" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>So let&#8217;s see how to use the<strong> .append() method</strong> with a simple, easy to follow example. This example assumes that we have 2 main divs with class &#8220;red&#8221; &amp; &#8220;green&#8221; applied to them &amp; these divs are held in another &#8220;container&#8221; div for easy manipulation. So what we are going to do is have 2 individual buttons that will let you append the red div to green div and vice-versa.  We also have another button that will reset the divs back to their original state, once the append method has been used on them dynamically.</p>
<p><strong>Here is the complete source code:</strong></p>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Easy examples for using the .append() method in jQuery&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.red {
	background-color: #FFA6A6;
	border: 1px solid red;
	margin: 10px;
}
.green {
	background-color: #CEFFCE;
	border: 1px solid green;
	margin: 10px;	
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="divs_container"&gt;

&lt;div id="mydiv1" class="red"&gt;This is my 1 div&lt;/div&gt;

&lt;div id="mydiv2" class="green"&gt;This is my 2 div&lt;/div&gt;

&lt;/div&gt;

&lt;input type="button" name="sbt_append_g2r" id="sbt_append_g2r" value="Append Green Div to Red"&gt;
&lt;input type="submit" name="sbt_remove" id="sbt_remove" value="Unappend/Remove"&gt;
&lt;input type="button" name="sbt_append_r2g" id="sbt_append_r2g" value="Append Red Div to Green"&gt;

&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

	var divs_container_html = $(".divs_container").html();

	//Append Green Div to Red
	$('#sbt_append_g2r').on("click", function(){

		$('.red').append($('.green'));

	});

	//Append Red Div to Green
	$('#sbt_append_r2g').on("click", function(){

		$('.green').append($('.red'));

	});	

	//Reset the divs back to their original state
	$('#sbt_remove').on("click", function(){		

		$(".divs_container").html(divs_container_html); 

	});		

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1445" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it for now!</h5>
<p>Do you know of any other ways to use <em><strong>jQuery append method</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-append-using-append-in-jquery-append-method-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1445</post-id>	</item>
		<item>
		<title>jQuery for loop Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-for-loop-iterate-over-array-using-for-each-loop-in-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-for-loop-iterate-over-array-using-for-each-loop-in-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 04 Nov 2012 15:57:57 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1420</guid>

					<description><![CDATA[If you are working with arrays, then at point or the other, you may have felt the need to iterate over array elements and get their individual values, etc. It&#8217;s very easy to iterate over array elements using for loop in jQuery and can be done using just couple of lines of code. So read [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you are working with arrays, then at point or the other, you may have felt the need to iterate over array elements and get their individual values, etc. It&#8217;s very easy to <em><strong>iterate over array elements using for loop in jQuery</strong></em> and can be done using just couple of lines of code. So read on if you want to find out how loop through array elements using jQuery.<span id="more-1420"></span></p>
<h2>How to Iterate Over Array using for each loop in jQuery</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1420" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Consider that we have an array of fruits names and we want to iterate over this array so that we can alert the individual values of this array.</p>
<h3>Example: HTML source for iterating over array using for each loop in jQuery</h3>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Iterate Over Array using for each loop in jQuery&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p&gt;
&lt;label&gt;
&lt;input type="checkbox" name="fruits[]" value="Apple" id="fruits_0"&gt;
Apple&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="checkbox" name="fruits[]" value="Mango" id="fruits_1"&gt;
Mango&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="checkbox" name="fruits[]" value="Watermelon" id="fruits_2"&gt;
Watermelon&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="checkbox" name="fruits[]" value="Strawberry" id="fruits_3"&gt;
Strawberry&lt;/label&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;input type="submit" name="sbt_alert_all" id="sbt_alert_all" value="Alert each elements of array"&gt;
&lt;input type="submit" name="sbt_alert_checked" id="sbt_alert_checked" value="Alert Checked elements"&gt;
&lt;input type="submit" name="sbt_alert_unchecked" id="sbt_alert_unchecked" value="Alert Unchecked elements"&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now I am going to show you ways to access the array values and indices based upon the situation, when the button is clicked. Following are the jQuery source codes for each case.</p>
<h3>Example 1: Iterate Over Array and alert all values along with array key/index number</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript"&gt;
//Alert all values along with array key/index number&lt;/pre&gt;
$('#sbt_alert_all').on("click", function(){

$('input[name="fruits[]"]').each(function(index) {
alert(index + ': ' + $(this).text() + $(this).val() );
});

});

&lt;/script&gt;</pre>
<h3>Example 2: Iterate Over Array and alert all CHECKED values along with array key/index number</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript"&gt;

//Alert all checked values along with array key/index number
$('#sbt_alert_checked').on("click", function(){

$('input[name="fruits[]"]:checked').each(function(index) {
alert(index + ': ' + $(this).text() + $(this).val() );
});

});

&lt;/script&gt;</pre>
<h3>Example 3: Iterate Over Array and alert all UNCHECKED values along with array key/index number</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript"&gt;
//Alert all unchecked values along with array key/index number
$('#sbt_alert_unchecked').on("click", function(){

$('input[name="fruits[]"]:not(:checked)').each(function(index) {
alert(index + ': ' + $(this).text() + $(this).val() );
});

});

&lt;/script&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1420" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>iterate over array elements using for each loop / for loop in jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-for-loop-iterate-over-array-using-for-each-loop-in-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1420</post-id>	</item>
		<item>
		<title>jQuery Change Class Examples &#8211; Add Class, Remove Class, Toggle Class &#038; more</title>
		<link>https://theextremewebdesigns.com/blog/jquery-change-class-add-class-remove-class-toggle-class-using-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-change-class-add-class-remove-class-toggle-class-using-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 01 Nov 2012 19:30:47 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1399</guid>

					<description><![CDATA[jQuery provides us with different methods to ease up the process of working with classes assigned to elements. Some of the main methods are to add class, remove Class, toggle Class &#38; to check if an element has a class or not, change class using jQuery. In this article, I am going to discuss all [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>jQuery provides us with different methods to ease up the process of working with classes assigned to elements. Some of the main methods are to <em><strong>add class, remove Class, toggle Class &amp; to check if an element has a class or not, change class using jQuery</strong></em>. In this article, I am going to discuss all of those methods with an example for each. <span id="more-1399"></span></p>
<h2>Examples to Add Class, Remove Class, Change Class, Toggle Class, Check if has Class using in jQuery</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1399" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we have a div with ID &#8220;<strong>my_div</strong>&#8220;. Now we will see how we can add a class, replace existing class, remove applied class, check to see if it has a specific class &amp; toggle class using jQuery with relevant examples.</p>
<h3>Here is the HTML source code common for all examples below:</h3>
<pre class="lang:xhtml decode:true crayon-selected">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Add Class, Remove Class, Toggle Class using jQuery&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery_1.7.1_min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.green {
background-color: #B3FFB3;
}

.red {
background-color: #FFBFBF;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div id="my_div"&gt;This is my div&lt;/div&gt;

&lt;input type="submit" name="add_class" id="add_class" value="Add Class Green"&gt;
&lt;input type="submit" name="remove_class" id="remove_class" value="Remove Class Green"&gt;
&lt;input type="submit" name="has_class" id="has_class" value="Has Class Red?"&gt;
&lt;input type="submit" name="toggle_class" id="toggle_class" value="Toggle Red Class"&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<h3>Example 1: Add a class to div using .addClass() method in jQuery</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

//Add a class to the div
$('#add_class').click( function(){

$('#my_div').addClass('green');

});

});

&lt;/script&gt;</pre>
<h3>Example 2: Remove an already applied class from the div using .removeClass() method in jQuery</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

//Remove an already applied class from the div
$('#remove_class').click( function(){

$('#my_div').removeClass('green');

});

});

&lt;/script&gt;</pre>
<h3>Example 3: Check if a class has already been applied or not using .hasClass() method in jQuery</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

//Check if a class has already been applied or not. Alerts true if has class or false if it does not have class
$('#has_class').click( function(){

alert( $('#my_div').hasClass('red') );

});

});

&lt;/script&gt;</pre>
<h3>Example 4: Toggle an existing class of the div with a new class using .toggleClass() method in jQuery</h3>
<pre class="lang:js decode:true">&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

//Toggle an existing class of the div with a new class
$('#toggle_class').click( function(){

$('#my_div').toggleClass('red');

});

});

&lt;/script&gt;</pre>
<p>In order to test the above example, if there&#8217;s no class applied to div and you click on the &#8216;Toggle Red Class&#8217; button, that will apply the red background color to the div. If you click on the button again, that will remove the red background color and thus make it a transparent background.</p>
<p>However, if you now click on the &#8216;Add Class Green&#8217; button &amp; then click on &#8216;Toggle Red Class&#8217; button twice, you will notice that when you first click the button, it will remove the green class &amp; apply the red class. When you click the button the second time, it will then remove the red class &amp; apply the class that was previously assigned to the div, i.e. the green class. So in short, Toggle class will simply toggle the recent most class with the class that has been already assigned to the element (if any).</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1399" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it for now!</h5>
<p>Do you know of any other ways to <em><strong>change class i.e. add class, remove class, toggle class, check if has class using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-change-class-add-class-remove-class-toggle-class-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1399</post-id>	</item>
		<item>
		<title>jQuery Check Class Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-check-class-check-if-element-has-class-using-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-check-class-check-if-element-has-class-using-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 01 Nov 2012 18:47:36 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1395</guid>

					<description><![CDATA[Do you wish to check if element has Class using jQuery but do not know where to begin? Worry no more! In this article, I am going to share a very easy and efficient way to check if any desired element has a specific class or not using jQuery. Read on to find out more. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Do you wish to check if element has Class using jQuery but do not know where to begin? Worry no more! In this article, I am going to share a very easy and efficient way to <em><strong>check if any desired element has a specific class or not using jQuery</strong></em>. Read on to find out more.<span id="more-1395"></span></p>
<h2>How to use jQuery Check Class</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1395" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we got couple of divs and they have id&#8217;s and classes assigned to them. In order to check class of the div, we can use a simple method called <strong>hasClass</strong>. The following is the full source code of a working example:</p>
<h3>Example to Check if element has Class using jQuery</h3>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery check if element has class&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery_1.7.1_min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div id="mydiv1" class="my_class1"&gt;This is my 1 div&lt;/div&gt;

&lt;div id="mydiv2" class="my_class2"&gt;This is my 2 div&lt;/div&gt;
&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

//The first div has the my_class1 applied to it, so the following will alert true
alert( $('#mydiv1').hasClass('my_class1') );

//The second div does NOT have the my_class345 applied to it, so the following will alert false
alert( $('#mydiv2').hasClass('my_class345') );

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1395" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>When you run the above code, you should be able to see 2 alerts. The first one would alert true &amp; the second one would alert false. I have left comments above the relevant lines in the source code for your guidance.</p>
<h5>Don&#8217;t you think it&#8217;s simple?</h5>
<p>Do you know of any other ways to <em><strong>check if an element has a specific class or not using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-check-class-check-if-element-has-class-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1395</post-id>	</item>
		<item>
		<title>jQuery Count Elements Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-count-elements-count-elements-with-class-using-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-count-elements-count-elements-with-class-using-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 01 Nov 2012 18:24:13 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1391</guid>

					<description><![CDATA[When working with different elements of a web page, it might be necessary at times to count the number of elements by using their class. In this article, I am going to share a very easy way to count the number of elements that have the same class using jQuery. The actual code is just [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>When working with different elements of a web page, it might be necessary at times to count the number of elements by using their class. In this article, I am going to share a very easy way to <em><strong>count the number of elements that have the same class using jQuery</strong></em>. The actual code is just 1 line, so it&#8217;s super easy to follow along.<span id="more-1391"></span></p>
<h2>How to Count Elements with Class using jQuery &#8211; Examples</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1391" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we got few divs in our web page and they all have a class of &#8220;my_class&#8221; applied to them. In such a case, we can count the number of divs easily. Following is the complete code (HTML + jQuery):</p>
<h3>Example: Count Elements with Class using jQuery</h3>
<pre class="lang:xhtml decode:true crayon-selected" title="Example">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Example&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.my_class {
	background-color: #DBF0FF;
	border: 1px solid #06F;
}
.my_class2 {
	background-color: #FFDF9D;
	border: 1px solid #F90;
}
.my_class3 {
	background-color: #D7FFD7;
	border: 1px solid #090;
}

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="my_class"&gt;This is my 1 div&lt;/div&gt;

&lt;div class="my_class"&gt;This is my 2 div&lt;/div&gt;

&lt;div class="my_class"&gt;This is my 3 div&lt;/div&gt;

&lt;div class="my_class2"&gt;This is my 4 div&lt;/div&gt;

&lt;div class="my_class2"&gt;This is my 5 div&lt;/div&gt;

&lt;div class="my_class3"&gt;This is my 6 div&lt;/div&gt;

&lt;p&gt;
  &lt;input type="submit" name="sbt_count" id="sbt_count" value="Count all divs that have .my_class (blue color background) applied to them "&gt;
&lt;/p&gt;

&lt;script type="text/javascript" language="javascript" &gt;

$(document).ready(function(){

	$('#sbt_count').on("click", function(e){		

		alert( $('.my_class').length );

		e.preventDefault();

	});		

});

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1391" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p><strong>Simple, isn&#8217;t it?</strong></p>
<p>Do you know of any other ways to <em><strong>get the count of elements with specific class using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-count-elements-count-elements-with-class-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1391</post-id>	</item>
	</channel>
</rss>
