<?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 events &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/jquery-events/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 11 Jul 2018 16:27:17 +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 events &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>jQuery no-conflict And Using Different Versions Of JQuery</title>
		<link>https://mail.sibeeshpassion.com/jquery-no-conflict-and-using-different-versions-of-jquery/</link>
					<comments>https://mail.sibeeshpassion.com/jquery-no-conflict-and-using-different-versions-of-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 12 Oct 2015 12:03:11 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[$ and $j as jquery]]></category>
		<category><![CDATA[jquery events]]></category>
		<category><![CDATA[jquery no-conflict]]></category>
		<category><![CDATA[Using Different Versions Of JQuery]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10793</guid>

					<description><![CDATA[In this post we will see what is jQuery no-conflict and what is the importance of jQuery no-conflict. We will also learn how can we use different versions of JQuery in the same page according to your need. jQuery no-conflict is an option given by the jQuery to over come the conflicts between the different js frameworks or libraries. When we use jQuery no-conflict mode, we are replacing the $ to a new variable and assign to jQuery. Here in this post we will explain this feature in deep and we will also create a demo of using different versions [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see what is jQuery no-conflict and what is the importance of jQuery no-conflict. We will also learn how can we use different versions of JQuery in the same page according to your need. jQuery no-conflict is an option given by the jQuery to over come the conflicts between the different js frameworks or libraries. When we use jQuery no-conflict mode, we are replacing the $ to a new variable and assign to jQuery. Here in this post we will explain this feature in deep and we will also create a demo of using different versions of jQuery together in one page. I hope you will like this. </p>
<p><strong>Download Source Code</strong></p>
<p>Please download the source code here: <a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQueryNoConflict.rar" target="_blank">jQuery noConflict</a></p>
<p><strong>Introduction</strong></p>
<p>As you all know, some other JavaScript libraries also uses the $ (Which is the default reference of jQuery) as a function or variable name as jQuery has. And in our development life, we are not at all strict to only jQuery, we may use lots of other libraries too. Isn&#8217;t it? I use different libraries in my projects to accomplish different tasks. So what will happen when we use those libraries? There will be conflicts between those libraries right since they all use $ as the variable name. The situation is really bad.</p>
<p>So we have only one chocolate and more number of winners, in real life we can just cut the chocolate into the number of winners, right? </p>
<div id="attachment_10794" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Dogs-Sharing-Food-e1444646199502.jpg"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-10794" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Dogs-Sharing-Food-1024x768.jpg" alt="Dogs Sharing Food" width="634" height="476" class="size-large wp-image-10794" /></a><p id="caption-attachment-10794" class="wp-caption-text">Dogs Sharing Food</p></div>
<p>But that won&#8217;t be accepted in this case, so we have an another option, this option is introduced by jQuery and it is jQuery no-conflict. </p>
<p><strong>Background</strong></p>
<p>I always use different libraries in my project, thus sometimes I faced these problem in my project. So I thought of sharing with you all who are facing this problem.</p>
<p><strong>Using the code</strong></p>
<p>The first thing you want to do is creating an <a href="http://sibeeshpassion.com/category/html/" target="_blank">HTML </a>page.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;JQuery noConflict &#8211; Sibeesh Passion&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    JQuery noConflict &#8211; Sibeesh Passion<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>So what is next? Adding reference ? Yes.</p>
<p>[js]<br />
&lt;script src=&quot;prototype.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>So we are using prototype lowest version and jquery together, in this case you will face conflict errors, and please be noted that the new version of prototype.js doesn&#8217;t have any conflict with jQuery since they updated and given the fix. </p>
<p>So what to do if you found any issues? you just need to give the $ to prototype and assign a new variable to jquery as follows.</p>
<p>[js]<br />
 &lt;script&gt;<br />
        // Give $ back to prototype.js; create new alias to jQuery.<br />
        var $jq = jQuery.noConflict();<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>And now you can use $jq as the new jQuery reference.</p>
<p>[js]<br />
 &lt;script&gt;<br />
        $jq(document).ready(function () {<br />
            $jq(&quot;#btn&quot;).on(&#8216;click&#8217;, function () {<br />
                alert(&#8216;Clicked&#8217;);<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
[/js]</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;JQuery noConflict &#8211; Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;prototype.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
     &lt;script&gt;<br />
         // Give $ to prototype.js<br />
         var $jq = jQuery.noConflict();<br />
    &lt;/script&gt;<br />
    &lt;script&gt;<br />
        $jq(document).ready(function () {<br />
            $jq(&quot;#btn&quot;).on(&#8216;click&#8217;, function () {<br />
                alert(&#8216;Clicked&#8217;);<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    JQuery noConflict &#8211; Sibeesh Passion<br />
     &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
     &lt;input type=&quot;button&quot; value=&quot;&quot; id=&#8217;btn&#8217; /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>Sometimes we may end up in a situation to use different version of jQuery in the same page right? </p>
<p><strong>Situation I faced</strong></p>
<p>I was working in an old project which was handled by a team few years back, at that time I got a minor work to do in that project, to do the task I was in a need to add the latest version of jQuery since the entire project was using the old reference of jQuery. I was in a situation that I should not remove the old references and update with the new one, if I do that there might be some issues with other functionalities right? Since the project was already in live, I didn&#8217;t take that risk. So I added the new version and used jQuery noConflict to avoid the reference issues. </p>
<p><strong>Using the code</strong></p>
<p>Here I am going to give you a demo of now to use different version of jQuery in one page.</p>
<p>First of all please add the needed reference to your page.</p>
<p>[js]<br />
&lt;script src=&quot;JQuery%20Versions/jquery-1.9.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.10.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.3.min.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Please be noted that we have added jQuery 1.9.0,1.10.1,1.11.0,1.11.1,1.11.3 in our page. </p>
<p>Now we need to add some buttons in the UI, later we will bind the click events of the same buttons. </p>
<p>[html]<br />
 &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.9.0&quot; id=&#8217;btn190&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.10.1&quot; id=&#8217;btn1101&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.0&quot; id=&#8217;btn1110&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.1&quot; id=&#8217;btn1111&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.3&quot; id=&#8217;btn1113&#8242; /&gt;<br />
[/html]</p>
<p>What is next, so we have added the different jQuery versions. Now we will create different variable names for each versions. Is that fine?</p>
<p>[js]<br />
 &lt;script src=&quot;JQuery%20Versions/jquery-1.9.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery190 = jQuery.noConflict();<br />
        window.jQuery = jQuery190;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.10.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1101 = jQuery.noConflict();<br />
        window.jQuery = jQuery1101;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1110 = jQuery.noConflict();<br />
        window.jQuery = jQuery1110;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1111 = jQuery.noConflict();<br />
        window.jQuery = jQuery1111;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.3.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1113 = jQuery.noConflict();<br />
        window.jQuery = jQuery1113;<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>So now we have added variable names for all the versions right? The next thing we are going to do is to fire the click events for each versions. </p>
<p>[js]<br />
 &lt;script&gt;<br />
        jQuery190(document).ready(function ($) {<br />
            //The codes for jQuery 1-9-0<br />
            $(&quot;#btn190&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1101(document).ready(function ($) {<br />
            //The codes for jQuery 1-10-1<br />
            $(&quot;#btn1101&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1110(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-0<br />
            $(&quot;#btn1110&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1111(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-1<br />
            $(&quot;#btn1111&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1113(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-3<br />
            $(&quot;#btn1113&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>So if you run your page and click the buttons, you can find that the related codes only get fired. </p>
<div id="attachment_10797" style="width: 655px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery.png"><img decoding="async" aria-describedby="caption-attachment-10797" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery.png" alt="jQuery no-conflict And Using Different Versions Of JQuery" width="645" height="306" class="size-full wp-image-10797" srcset="/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery.png 645w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery-300x142.png 300w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery-400x190.png 400w" sizes="(max-width: 645px) 100vw, 645px" /></a><p id="caption-attachment-10797" class="wp-caption-text">jQuery no-conflict And Using Different Versions Of JQuery</p></div>
<div id="attachment_10798" style="width: 643px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_1.png"><img decoding="async" aria-describedby="caption-attachment-10798" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_1.png" alt="jQuery no-conflict And Using Different Versions Of JQuery" width="633" height="312" class="size-full wp-image-10798" srcset="/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_1.png 633w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_1-300x148.png 300w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_1-400x197.png 400w" sizes="(max-width: 633px) 100vw, 633px" /></a><p id="caption-attachment-10798" class="wp-caption-text">jQuery no-conflict And Using Different Versions Of JQuery</p></div>
<p>Now what if you comment out the variable declaration for jQuery version 1.11.3? </p>
<p>[js]<br />
//var jQuery1113 = jQuery.noConflict();<br />
        //window.jQuery = jQuery1113;<br />
[/js]</p>
<p>You will get an error says <em>Uncaught ReferenceError: jQuery1113 is not defined</em> in browser console. </p>
<div id="attachment_10799" style="width: 647px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2.png"><img decoding="async" aria-describedby="caption-attachment-10799" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2.png" alt="jQuery no-conflict And Using Different Versions Of JQuery" width="637" height="336" class="size-full wp-image-10799" srcset="/wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2.png 637w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2-300x158.png 300w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2-600x315.png 600w, /wp-content/uploads/2015/10/jQuery_no-conflict_And_Using_Different_Versions_Of_JQuery_2-400x211.png 400w" sizes="(max-width: 637px) 100vw, 637px" /></a><p id="caption-attachment-10799" class="wp-caption-text">jQuery no-conflict And Using Different Versions Of JQuery</p></div>
<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;Use JQuery Different Versions in One Page &#8211; Sibeesh Passion&lt;/title&gt;</p>
<p>    &lt;script src=&quot;JQuery%20Versions/jquery-1.9.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery190 = jQuery.noConflict();<br />
        window.jQuery = jQuery190;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.10.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1101 = jQuery.noConflict();<br />
        window.jQuery = jQuery1101;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1110 = jQuery.noConflict();<br />
        window.jQuery = jQuery1110;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var jQuery1111 = jQuery.noConflict();<br />
        window.jQuery = jQuery1111;<br />
    &lt;/script&gt;<br />
    &lt;script src=&quot;JQuery%20Versions/jquery-1.11.3.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        //var jQuery1113 = jQuery.noConflict();<br />
        //window.jQuery = jQuery1113;<br />
    &lt;/script&gt;<br />
    &lt;script&gt;<br />
        jQuery190(document).ready(function ($) {<br />
            //The codes for jQuery 1-9-0<br />
            $(&quot;#btn190&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1101(document).ready(function ($) {<br />
            //The codes for jQuery 1-10-1<br />
            $(&quot;#btn1101&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1110(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-0<br />
            $(&quot;#btn1110&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1111(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-1<br />
            $(&quot;#btn1111&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
        jQuery1113(document).ready(function ($) {<br />
            //The codes for jQuery 1-11-3<br />
            $(&quot;#btn1113&quot;).on(&#8216;click&#8217;, function () {<br />
                alert($.fn.jquery);<br />
            })<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Use JQuery Different Versions in One Page<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.9.0&quot; id=&#8217;btn190&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.10.1&quot; id=&#8217;btn1101&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.0&quot; id=&#8217;btn1110&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.1&quot; id=&#8217;btn1111&#8242; /&gt;<br />
    &lt;input type=&quot;button&quot; value=&quot;Use jQuery 1.11.3&quot; id=&#8217;btn1113&#8242; /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>That&#8217;s all.</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever used different versions of jQuery in same page? Have you ever tried jQuery noConflict? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/jquery-no-conflict-and-using-different-versions-of-jquery/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Remove a DOM element using JQuery</title>
		<link>https://mail.sibeeshpassion.com/remove-a-dom-element-using-jquery/</link>
					<comments>https://mail.sibeeshpassion.com/remove-a-dom-element-using-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 01 Jul 2015 10:22:00 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[.remove()]]></category>
		<category><![CDATA[delete UI]]></category>
		<category><![CDATA[jquery events]]></category>
		<category><![CDATA[jquery functions]]></category>
		<category><![CDATA[remove DOM]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=5981</guid>

					<description><![CDATA[Introduction Hi All, How are you today? In this article we will see how we can remove a DOM element using JQuery. I hope you will like it. Background I know we all are working in the client side technologies, especially in JQuery. Sometimes we may need to write more client side codes rather than server side codes. In that case, you may need to remove some DOM elements pragmatically. Here I am going to give you a demo of how we can do this requirement. Using the code To start with, as you all know we need to load [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Hi All, How are you today? In this article we will see how we can remove a DOM element using JQuery. I hope you will like it.</p>
<p><strong>Background</strong></p>
<p>I know we all are working in the client side technologies, especially in JQuery. Sometimes we may need to write more client side codes rather than server side codes. In that case, you may need to remove some DOM elements pragmatically. Here I am going to give you a demo of how we can do this requirement.</p>
<p><strong>Using the code</strong></p>
<p>To start with, as you all know we need to load the 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>Once you load the reference you are ready to go.</p>
<p>Since this is a demo, we will explain with some steps. Sounds good?. So we will do the following tasks.</p>
<li>Add the elements to the DOM</li>
<li>Delete the DOM elements using <em>.remove()</em>, <em>.get()</em> functions</li>
<p>Shall we start then?</p>
<p><strong>Add the elements to the DOM</strong></p>
<p>We need to set our UI first right?</p>
<p>[html]<br />
&lt;body id=&quot;body&quot;&gt;<br />
    Remove a DOM element from the UI using JQuery- Sibeesh Passion<br />
    &lt;br/&gt;<br />
    &lt;br/&gt;<br />
    &lt;p id=&quot;addMe&quot;&gt;Generate 10 Elements&lt;/p&gt;<br />
&lt;/body&gt;<br />
[/html]</p>
<p><strong>Add CSS</strong><br />
[css]<br />
&lt;style&gt;<br />
        p {<br />
            color: red;<br />
            width: 170px;<br />
            cursor: pointer;<br />
            border: 1px solid #ccc;<br />
            text-align: center;<br />
        }<br />
        #deleteMe {<br />
            color: white;<br />
            width: 170px;<br />
            cursor: pointer;<br />
            border: 1px solid #ccc;<br />
            text-align: center;<br />
            background-color: blue;<br />
        }<br />
    &lt;/style&gt;<br />
[/css]</p>
<p>So we have set our UI, and now if you run your page you can see output as follows.</p>
<p><img decoding="async" src="http://www.sibeeshpassion.com/content/images/rmdm1.png" alt="www.sibeeshpassion.com" /></p>
<p>Now we will add the needful scripts.</p>
<p>[js]<br />
 &lt;script&gt;<br />
        $(document).ready(function() {<br />
            $(&quot;#addMe&quot;).click(function() {<br />
                var html = &#8216;&lt;table&gt;&#8217;;<br />
                for (var i = 1; i &lt;= 10; i++) {<br />
                    html += &quot;&lt;tr&gt;&lt;p&gt;My Elements&lt;/p&gt;&lt;/tr&gt;&quot;;<br />
                }<br />
                html += &#8216;&lt;/table&gt;&#8217;;<br />
                $(&#8216;#body&#8217;).append(html).append(&#8216;&lt;div id=&quot;deleteMe&quot;&gt;Delete 5 Elements&lt;/div&gt;&#8217;);<br />
                $(&quot;#addMe&quot;).hide();<br />
            });<br />
            $(document).on(&#8216;click&#8217;, &#8216;#deleteMe&#8217;, function() {<br />
                for (var i = 1; i &lt;= 5; i++) {<br />
                    $(&#8216;#body&#8217;).find(&#8216;p&#8217;).get(i).remove();<br />
                }<br />
                $(&quot;#addMe&quot;).hide();<br />
                $(&quot;#deleteMe&quot;).hide();<br />
            });</p>
<p>        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>As you can see we are adding elements to the DOM with a loop. Once you run the page you can see the output as follows.</p>
<p><img decoding="async" src="http://www.sibeeshpassion.com/content/images/rmdm2.png" alt="www.sibeeshpassion.com" /></p>
<p>And once you click on &#8220;Delete 5 Elements&#8221; button, 5 DOM elements will be deleted.</p>
<p><img decoding="async" src="http://www.sibeeshpassion.com/content/images/rmdm3.png" alt="www.sibeeshpassion.com" /></p>
<p>The following code block describes how we can use <em>.remove()</em> function.</p>
<p>[js]<br />
 $(&#8216;#body&#8217;).find(&#8216;p&#8217;).get(i).remove();<br />
[/js]</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;html&gt;</p>
<p>&lt;head&gt;<br />
    &lt;title&gt;emove a DOM element from the UI usign JQuery- Sibeesh Passion&lt;/title&gt;<br />
    &lt;style&gt;<br />
        p {<br />
            color: red;<br />
            width: 170px;<br />
            cursor: pointer;<br />
            border: 1px solid #ccc;<br />
            text-align: center;<br />
        }<br />
        #deleteMe {<br />
            color: white;<br />
            width: 170px;<br />
            cursor: pointer;<br />
            border: 1px solid #ccc;<br />
            text-align: center;<br />
            background-color: blue;<br />
        }<br />
    &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;</p>
<p>&lt;body id=&quot;body&quot;&gt;<br />
    Remove a DOM element from the UI using JQuery- Sibeesh Passion<br />
    &lt;br/&gt;<br />
    &lt;br/&gt;<br />
    &lt;p id=&quot;addMe&quot;&gt;Generate 10 Elements&lt;/p&gt;<br />
    &lt;script&gt;<br />
        $(document).ready(function() {<br />
            $(&quot;#addMe&quot;).click(function() {<br />
                var html = &#8216;&lt;table&gt;&#8217;;<br />
                for (var i = 1; i &lt;= 10; i++) {<br />
                    html += &quot;&lt;tr&gt;&lt;p&gt;My Elements&lt;/p&gt;&lt;/tr&gt;&quot;;<br />
                }<br />
                html += &#8216;&lt;/table&gt;&#8217;;<br />
                $(&#8216;#body&#8217;).append(html).append(&#8216;&lt;div id=&quot;deleteMe&quot;&gt;Delete 5 Elements&lt;/div&gt;&#8217;);<br />
                $(&quot;#addMe&quot;).hide();<br />
            });<br />
            $(document).on(&#8216;click&#8217;, &#8216;#deleteMe&#8217;, function() {<br />
                for (var i = 1; i &lt;= 5; i++) {<br />
                    $(&#8216;#body&#8217;).find(&#8216;p&#8217;).get(i).remove();<br />
                }<br />
                $(&quot;#addMe&quot;).hide();<br />
                $(&quot;#deleteMe&quot;).hide();<br />
            });</p>
<p>        });<br />
    &lt;/script&gt;<br />
&lt;/body&gt;</p>
<p>&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you will like this article. Please share me your valuable thoughts and comments. Your feedback is always welcomed.</p>
<p>Thanks in advance. Happy coding!</p>
<p>Kindest Regards<br />
<a href="https://plus.google.com/+sibeeshkv" target="_blank">Sibeesh Venu</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/remove-a-dom-element-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Load Data on Scroll Using jQuery</title>
		<link>https://mail.sibeeshpassion.com/load-data-on-scroll-using-jquery/</link>
					<comments>https://mail.sibeeshpassion.com/load-data-on-scroll-using-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 30 Jun 2015 01:49:09 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery events]]></category>
		<category><![CDATA[jQuery onScroll Data Loading]]></category>
		<category><![CDATA[Load Data jQuery]]></category>
		<category><![CDATA[onscroll]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=2111</guid>

					<description><![CDATA[Introduction Hi all, how are you today? This article explains how to load data on demand or load data when the user scrolls. Here we will do this in a simple manner, I hope you enjoy it. Download Source Code LoadDataOnScroll Background A few days ago one of my colleagues asked me how to load data into the UL when we do scroll. I could help him on that time itself. But here I am writing this article for his future reference. In this way we can do this very easily. Using the code Since we will load the data [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Hi all, how are you today? This article explains how to load data on demand or load data when the user scrolls. Here we will do this in a simple manner, I hope you enjoy it.</p>
<p><strong>Download Source Code</strong></p>
<li><a href="http://sibeeshpassion.com/download/LoadDataOnScroll.rar" target="_blank">LoadDataOnScroll</a></li>
<p><strong>Background</strong></p>
<p>A few days ago one of my colleagues asked me how to load data into the UL when we do scroll. I could help him on that time itself. But here I am writing this article for his future reference. In this way we can do this very easily.</p>
<p><strong>Using the code</strong></p>
<p>Since we will load the data on a scroll, we need to fire the window events. So I suggest include a jQuery plugin in your page as in the following:<br />
[js]<br />
&lt;script src=“jquery-2.1.4.min.js”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Once you are done, you are ready to go!</p>
<p>Our next step is load some initial or static data.<br />
[html]<br />
&lt;div id=“myScroll”&gt;<br />
        &lt;p&gt;<br />
            Contents will load here!!!.&lt;br /&gt;<br />
        &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
    &lt;/div&gt;<br />
[/html]</p>
<p>Now we need some styles, right?</p>
<p>[css]<br />
&lt;style&gt;<br />
        #myScroll {<br />
            border: 1px solid #999;<br />
        }<br />
        p {<br />
            border: 1px solid #ccc;<br />
            padding: 5px;<br />
            text-align: center;<br />
        }<br />
        .loading {<br />
            color: red;<br />
        }<br />
        .dynamic {<br />
            background-color:#ccc;<br />
            color:#000;<br />
        }<br />
    &lt;/style&gt;<br />
[/css]</p>
<p>What is next? Shall we run it and see our page now?</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/load-data-on-scroll/Images/ldscrl1.PNG" alt="" /></p>
<p>So now we have loaded the static data. Now it is time to fire the scroll event.<br />
[js]<br />
$(window).scroll(function () {<br />
           if ($(window).scrollTop() == $(document).height() – $(window).height()) {<br />
               appendData();<br />
           }<br />
       });<br />
[/js]</p>
<p>In the preceding code, I am calling the scroll event  and when  the condition <em>$(window).scrollTop() == $(document).height() – $(window).height()</em> is satisfied, I am calling a function. You can see the function below.<br />
[js]<br />
function appendData() {<br />
           var html = ”;<br />
           for (i = 0; i &lt; 10; i++) {<br />
               html += ‘&lt;p class=”dynamic”&gt;Dynamic Data : Life treats you in the same way, how you treat your life.Follow your passion, be prepared, do not let anyone limit your dreams. My Passion towards my life !!! – See more at:&lt;a href=”http://sibeeshpassion.com/”&gt;http://sibeeshpassion.com/&lt;/a&gt; &lt;/p&gt;’;<br />
           }<br />
           $(‘#myScroll’).append(html);<br />
       }<br />
[/js]</p>
<p>Here I am populating 10 records dynamically and appending the created data to our main element. Once you are done, you can see the output as in the following.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/load-data-on-scroll/Images/ldscrl2.PNG" alt="" /></p>
<p><strong>Complete Code</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Load data on demand demo – Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=“jquery-2.1.4.min.js”&gt;&lt;/script&gt;<br />
    &lt;style&gt;<br />
        #myScroll {<br />
            border: 1px solid #999;<br />
        }<br />
        p {<br />
            border: 1px solid #ccc;<br />
            padding: 5px;<br />
            text-align: center;<br />
        }<br />
        .loading {<br />
            color: red;<br />
        }<br />
        .dynamic {<br />
            background-color:#ccc;<br />
            color:#000;<br />
        }<br />
    &lt;/style&gt;<br />
    &lt;script&gt;<br />
        $(window).scroll(function () {<br />
            if ($(window).scrollTop() == $(document).height() – $(window).height()) {<br />
                appendData();<br />
            }<br />
        });<br />
        function appendData() {<br />
            var html = ”;<br />
            for (i = 0; i &lt; 10; i++) {<br />
                html += ‘&lt;p class=”dynamic”&gt;Dynamic Data : Life treats you in the same way, how you treat your life.Follow your passion, be prepared, do not let anyone limit your dreams. My Passion towards my life !!! – See more at:&lt;a href=”http://sibeeshpassion.com/”&gt;http://sibeeshpassion.com/&lt;/a&gt; &lt;/p&gt;’;<br />
            }<br />
            $(‘#myScroll’).append(html);<br />
        }<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;div id=“myScroll”&gt;<br />
        &lt;p&gt;<br />
            Contents will load here!!!.&lt;br /&gt;<br />
        &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
        &lt;p &gt;Life treats you in the same way, how you treat your life.Follow your passion, be prepared, don’t let anyone limit your dreams. My Passion towards my life !!! – See more at: http://sibeeshpassion.com/ &lt;/p&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Please download the source code for more details. I hope you liked this article. Now please share your thoughts and suggestions. It matters a lot.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/load-data-on-scroll-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to make an event calls only once in JQuery</title>
		<link>https://mail.sibeeshpassion.com/how-to-make-an-event-calls-only-once-in-jquery/</link>
					<comments>https://mail.sibeeshpassion.com/how-to-make-an-event-calls-only-once-in-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 22 Jun 2015 07:50:58 +0000</pubDate>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[.one()]]></category>
		<category><![CDATA[call event once]]></category>
		<category><![CDATA[jquery events]]></category>
		<category><![CDATA[jquery one]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=5341</guid>

					<description><![CDATA[Today we will learn how we will learn how we can make an event to be fired only once in JQuery. This is a simple demo of JQuery .one() function. You may have gone through this situation in your development life. I hope you will like this. Background While I was doing some tasks, I wanted to make a click event which is to be fired only once for a user when the user is logged in. I used the JQuery .one function to do the requirement. So I thought of sharing you that. Using the code AS you all [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we will learn how we will learn how we can make an event to be fired only once in JQuery. This is a simple demo of JQuery .one() function. You may have gone through this situation in your development life. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>While I was doing some tasks, I wanted to make a click event which is to be fired only once for a user when the user is logged in. I used the JQuery .one function to do the requirement. So I thought of sharing you that.</p>
<p><strong>Using the code</strong></p>
<p>AS you all know we can handle so many events in client side by using JQuery. Hereby I am sharing you one of those event which will definitely help you one day in your application.</p>
<p>To start with load the JQuery reference. I am using Google CDN here.</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 will create a &#8216;p&#8217; tag.</p>
<p>[html]<br />
&lt;p&gt;Click Me&lt;/p&gt;<br />
[/html]</p>
<p>What next? Style that &#8216;p&#8217; tag?</p>
<p>[css]<br />
 p {<br />
  color: red;<br />
  width: auto;<br />
  height: 50px;<br />
  margin: 250px;<br />
  border: 1px solid #ccc;<br />
  padding: 25px;<br />
  text-align: center;<br />
}<br />
[/css]</p>
<p>Now it is time to start our JQuery coding. For that we are going to create a document ready event and a click event.</p>
<p>[js]<br />
&lt;script&gt;<br />
$(document).ready(function(){<br />
	$(&quot;p&quot;).one( &quot;click&quot;, function() {<br />
	  $(this ).text(&quot;You clicked me!. Now you can&#8217;t do anything!!!!&quot;);<br />
	});<br />
});<br />
&lt;/script&gt;<br />
[/js]</p>
<p>So what does this .one() function does is, it will make sure that element&#8217;s click event is fired only once.</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
  &lt;title&gt;JQuery one demo &#8211; Sibeesh Passion&lt;/title&gt;<br />
  &lt;style&gt;<br />
 p {<br />
  color: red;<br />
  width: auto;<br />
  height: 50px;<br />
  margin: 250px;<br />
  border: 1px solid #ccc;<br />
  padding: 25px;<br />
  text-align: center;<br />
}<br />
  &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;p&gt;Click Me&lt;/p&gt;<br />
&lt;script&gt;<br />
$(document).ready(function(){<br />
	$(&quot;p&quot;).one( &quot;click&quot;, function() {<br />
	  $(this ).text(&quot;You clicked me!. Now you can&#8217;t do anything!!!!&quot;);<br />
	});<br />
});<br />
&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>Now we will see the output.</p>
<p><strong>Output</strong></p>
<p><img decoding="async" src="http://www.sibeeshpassion.com/content/images/jqueryonedemo.gif" alt="" /></p>
<p><strong>Conclusion</strong></p>
<p>I hope you will like this article. Please share me your valuable thoughts and comments. Your feedback is always welcomed.</p>
<p>Thanks in advance. Happy coding!</p>
<p>Kindest Regards<br />
<a href="https://plus.google.com/+sibeeshkv" target="_blank">Sibeesh Venu</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/how-to-make-an-event-calls-only-once-in-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
