<?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>Helmut Granda &#187; JQuery</title>
	<atom:link href="http://www.helmutgranda.com/category/programming/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.helmutgranda.com</link>
	<description>learning through interaction</description>
	<lastBuildDate>Mon, 19 Jul 2010 15:01:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>JQuery and dynamic elements</title>
		<link>http://www.helmutgranda.com/2009/04/16/jquery-and-dynamic-elements/</link>
		<comments>http://www.helmutgranda.com/2009/04/16/jquery-and-dynamic-elements/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 03:46:53 +0000</pubDate>
		<dc:creator>Helmut Granda</dc:creator>
				<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.helmutgranda.com/?p=314</guid>
		<description><![CDATA[I have been working with JQuery on a couple of work and personal projects and I really like the library. One of my first challenges was to access elements dynamically and at the same time trigger custom events. This is specially necessary when working with elements where you don't know the source of the data [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working with JQuery on a couple of work and personal projects and I really like the library. One of my first challenges was to access elements dynamically and at the same time trigger custom events. This is specially necessary when working with elements where you don't know the source of the data in detail. </p>
<p>Here is a sample as a reference:</p>
<div class="syntax_hilite"><strong>JavaScript:</strong>
<div id="js-1">
<div>
<ol style="">$(document).ready(function() {<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var idTotal = 5;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;for ( var i = 1 ; i &lt; idTotal ; i++)<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var deleteMinutes = $(&quot;#deleteMinutes_&quot;+i);<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;attachEvents ( deleteMinutes ) ;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var updateMinutes = $(&quot;#updateMinutes_&quot;+i);<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;attachEvents ( updateMinutes ) ;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp; });<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;var globalID;<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function attachEvents ( $item )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$item.bind(&quot;click&quot;, &nbsp; &nbsp;&nbsp; &nbsp;clickHandler );<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$item.bind(&quot;mouseenter&quot;, &nbsp; &nbsp;hoverHandler );<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$item.bind(&quot;mouseleave&quot;, &nbsp; &nbsp;mouseleaveHandler );<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$item.bind(&quot;mousedown&quot;, mousedownHandler );<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$item.bind(&quot;mouseup&quot;, &nbsp; &nbsp;mouseupHandler );&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function clickHandler ( $event )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var target = $event.target.id;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var id = target.charAt(target.length-1);<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;globalID = id;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$('#dialog').dialog('open');<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function hoverHandler ( )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$(this).addClass(&quot;ui-state-hover&quot;);<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function mouseleaveHandler ( )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$(this).removeClass(&quot;ui-state-hover&quot;);<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function mousedownHandler ( )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$(this).addClass(&quot;ui-state-active&quot;);<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function mouseupHandler ( )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$(this).removeClass(&quot;ui-state-active&quot;);<br />
&nbsp; &nbsp;&nbsp; &nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;function deleteItemSelected ( )<br />
&nbsp; &nbsp;&nbsp; &nbsp;{<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$(&quot;#minutes_&quot;+globalID).remove();<br />
&nbsp; &nbsp;&nbsp; &nbsp;}</ol>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.helmutgranda.com/2009/04/16/jquery-and-dynamic-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
