<?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>Ryan Coughlin &#124; Web and Graphic Designer &#187; bind</title>
	<atom:link href="http://www.ryancoughlin.com/tag/bind/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ryancoughlin.com</link>
	<description></description>
	<lastBuildDate>Fri, 26 Mar 2010 00:07:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Working with the jQuery live function</title>
		<link>http://www.ryancoughlin.com/2009/05/04/working-with-the-jquery-live-function/</link>
		<comments>http://www.ryancoughlin.com/2009/05/04/working-with-the-jquery-live-function/#comments</comments>
		<pubDate>Mon, 04 May 2009 13:56:18 +0000</pubDate>
		<dc:creator>Ryan Coughlin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[live]]></category>

		<guid isPermaLink="false">http://www.ryancoughlin.com/?p=450</guid>
		<description><![CDATA[Find out how to use jQuery .live() and how it compares with .click()


Related posts:<ol><li><a href='http://www.ryancoughlin.com/2009/01/22/jquery-timeout-function/' rel='bookmark' title='Permanent Link: jQuery Timeout Function'>jQuery Timeout Function</a> <small>A neat and simple way to creating a jQuery function...</small></li>
<li><a href='http://www.ryancoughlin.com/2009/03/30/create-a-jquery-accordion-remain-open-after-page-load/' rel='bookmark' title='Permanent Link: Create a jQuery Accordion &#8211; remain open after page load'>Create a jQuery Accordion &#8211; remain open after page load</a> <small>Quick fix to keep accordion section open after loading different...</small></li>
<li><a href='http://www.ryancoughlin.com/2008/11/23/combining-selectables-and-draggables-using-jquery-ui/' rel='bookmark' title='Permanent Link: Combining Selectables And Draggables Using jQuery UI'>Combining Selectables And Draggables Using jQuery UI</a> <small>Learn how to work with both selectable and draggable with...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The other day, I wasn&#8217;t really too acquainted with the .live() jQuery function. I did some research and it finally clicked for me. I put together a <a href="http://ryancoughlin.com/demos/live/jquery.live.html" target="_blank">quick example</a> that can I uploaded. The basics of the function can be known as:</p>
<blockquote><p>Binds a handler to an event (like click) for all current &#8211; and future &#8211; matched element.  Can also bind custom events. &#8211; (source: jquery.com)</p></blockquote>
<p>This function is extremely similar to the .click() but .click() will only match elements that are created via the XHTML with DOM is loaded. With that said, using .live() is extremely useful for dynamic websites, where you are creating/removing elements on you&#8217;re website.</p>
<p>Lets see the base example of using .live()</p>
<pre class="js" title="code">
$('a.edit').live('click', function() {
     alert("The power of .live() - dynamically created objects will have bound events!")
     return false;
});
</pre>
<p>This code will work for all links that have the class edit, even when new a.link tags are created dynamically after DOM has been loaded. If your code looked like:</p>
<pre class="js" title="code">
$('a.edit-nolive').click(function() {
     alert("Items created via AJAX will be called on using .live()")
     return false;
});</pre>
<p>It would not work on dynamically created items. Lets take another look at the <a href="http://ryancoughlin.com/demos/live/jquery.live.html" target="_blank">full demo</a>. Hopefully this will clear up any problems with understanding how the jQuery .live() function works in comparison to the .click() event. Like to see something else like this? Drop me a line.</p>


<p>Related posts:<ol><li><a href='http://www.ryancoughlin.com/2009/01/22/jquery-timeout-function/' rel='bookmark' title='Permanent Link: jQuery Timeout Function'>jQuery Timeout Function</a> <small>A neat and simple way to creating a jQuery function...</small></li>
<li><a href='http://www.ryancoughlin.com/2009/03/30/create-a-jquery-accordion-remain-open-after-page-load/' rel='bookmark' title='Permanent Link: Create a jQuery Accordion &#8211; remain open after page load'>Create a jQuery Accordion &#8211; remain open after page load</a> <small>Quick fix to keep accordion section open after loading different...</small></li>
<li><a href='http://www.ryancoughlin.com/2008/11/23/combining-selectables-and-draggables-using-jquery-ui/' rel='bookmark' title='Permanent Link: Combining Selectables And Draggables Using jQuery UI'>Combining Selectables And Draggables Using jQuery UI</a> <small>Learn how to work with both selectable and draggable with...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ryancoughlin.com/2009/05/04/working-with-the-jquery-live-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
