<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: What is this?</title>
	<link>http://www.learningjquery.com/2007/08/what-is-this</link>
	<description>Getting to know the library of choice for unobtrusive JavaScript</description>
	<pubDate>Fri, 29 Aug 2008 00:23:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Raimund</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-37446</link>
		<dc:creator>Raimund</dc:creator>
		<pubDate>Fri, 04 Apr 2008 09:51:36 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-37446</guid>
		<description>how do i get the received content of the ajax-/get-function to the div element again ?

thanks...
raimund</description>
		<content:encoded><![CDATA[<p>how do i get the received content of the ajax-/get-function to the div element again ?</p>
<p>thanks&#8230;<br />
raimund</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stefan</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-32684</link>
		<dc:creator>stefan</dc:creator>
		<pubDate>Thu, 06 Mar 2008 09:42:18 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-32684</guid>
		<description>hello , i am trying to use the jQuery load() function , i am using it like this $("#mydiv").load("myfile.php?argument=x");
all works fine untill i want to process the results returned by the function , meaning that the file myfile.php prints some parts of an  form based on some arguments received , the problem is that when i want to process the values of the form elements i cannot because it hasn't generated any html code for them , you can see the problem at www.potirnel.8k.ro/formular2/ , any help is great. potirnel@yahoo.com</description>
		<content:encoded><![CDATA[<p>hello , i am trying to use the jQuery load() function , i am using it like this $(&#8221;#mydiv&#8221;).load(&#8221;myfile.php?argument=x&#8221;);<br />
all works fine untill i want to process the results returned by the function , meaning that the file myfile.php prints some parts of an  form based on some arguments received , the problem is that when i want to process the values of the form elements i cannot because it hasn&#8217;t generated any html code for them , you can see the problem at <a href="http://www.potirnel.8k.ro/formular2/" rel="nofollow">www.potirnel.8k.ro/formular2/</a> , any help is great. <a href="mailto:potirnel@yahoo.com">potirnel@yahoo.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Alsup</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-13032</link>
		<dc:creator>Mike Alsup</dc:creator>
		<pubDate>Sat, 15 Sep 2007 00:24:26 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-13032</guid>
		<description>@Tyson:  You just need to create a closure to capture the object you need to reference in the callback. For example:
&lt;code&gt;
    ...
    var self = this;
    $('#myElement').click(function() {
        // here you can use 'self' to reference
        // the enclosing object
    });
    ...
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@Tyson:  You just need to create a closure to capture the object you need to reference in the callback. For example:<br />
<code><br />
    ...<br />
    var self = this;<br />
    $('#myElement').click(function() {<br />
        // here you can use 'self' to reference<br />
        // the enclosing object<br />
    });<br />
    ...<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carter</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-11970</link>
		<dc:creator>Carter</dc:creator>
		<pubDate>Thu, 06 Sep 2007 22:44:02 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-11970</guid>
		<description>Tyson (and anyone else searching this),
This is how I've been doing it:

&lt;pre&gt;&lt;code&gt;$(".button").bind("click", {that:this}, function(event) {
      var that = event.data.that;
      that.handleEvent();
      return false;
});&lt;/code&gt;&lt;/pre&gt;

If you pass in an object after the binding event type arg ("click") it get's tacked onto the event's "data" property. I've been looking for a nicer way to do this... just posted in the google groups forum. Prototype has a bindAsEventListener method that you can tack onto any function to let you say what you want "this" to reference inside the function. 

Hope this helps,
Carter</description>
		<content:encoded><![CDATA[<p>Tyson (and anyone else searching this),<br />
This is how I&#8217;ve been doing it:</p>
<pre><code>$(".button").bind("click", {that:this}, function(event) {
      var that = event.data.that;
      that.handleEvent();
      return false;
});</code></pre>
<p>If you pass in an object after the binding event type arg (&#8221;click&#8221;) it get&#8217;s tacked onto the event&#8217;s &#8220;data&#8221; property. I&#8217;ve been looking for a nicer way to do this&#8230; just posted in the google groups forum. Prototype has a bindAsEventListener method that you can tack onto any function to let you say what you want &#8220;this&#8221; to reference inside the function. </p>
<p>Hope this helps,<br />
Carter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyson</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-11322</link>
		<dc:creator>Tyson</dc:creator>
		<pubDate>Sun, 02 Sep 2007 19:42:09 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-11322</guid>
		<description>When you call Jquery from within function in a custom Javascript class, how do you refer to the containing object in the Jquery callback function since Jquery uses "this" to refer to the DOM object in the callback function?</description>
		<content:encoded><![CDATA[<p>When you call Jquery from within function in a custom Javascript class, how do you refer to the containing object in the Jquery callback function since Jquery uses &#8220;this&#8221; to refer to the DOM object in the callback function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Alsup</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-10935</link>
		<dc:creator>Mike Alsup</dc:creator>
		<pubDate>Thu, 30 Aug 2007 12:46:38 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-10935</guid>
		<description>Jeroen, &lt;code&gt;$this&lt;/code&gt; is just a naming convention used by many jQuery developers.  It helps you remember that the variable is a jQuery object rather than a DOM element (assuming you're following the convention).  For example:
&lt;code&gt;
$('#myButton').click(function() {
    // in the event handler 'this' is a DOM element
    alert (this.id == 'myButton');

    // wrap this in a jQuery object so we can use the jQuery API
    var $this = $(this);

    // now we have this and $this to play with
    alert( $this.attr('id') == 'myButton');
});</description>
		<content:encoded><![CDATA[<p>Jeroen, <code>$this</code> is just a naming convention used by many jQuery developers.  It helps you remember that the variable is a jQuery object rather than a DOM element (assuming you&#8217;re following the convention).  For example:<br />
<code><br />
$('#myButton').click(function() {<br />
    // in the event handler 'this' is a DOM element<br />
    alert (this.id == 'myButton');</p>
<p>    // wrap this in a jQuery object so we can use the jQuery API<br />
    var $this = $(this);</p>
<p>    // now we have this and $this to play with<br />
    alert( $this.attr('id') == 'myButton');<br />
});</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Coumans</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-10913</link>
		<dc:creator>Jeroen Coumans</dc:creator>
		<pubDate>Thu, 30 Aug 2007 09:31:48 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-10913</guid>
		<description>Like Bill, I'm also having trouble combining &lt;code&gt;this&lt;/code&gt; and/or &lt;code&gt;$(this)&lt;/code&gt; with selectors. A future blog post exploring this topic would be greatly appreciated for us beginners!  :-)</description>
		<content:encoded><![CDATA[<p>Like Bill, I&#8217;m also having trouble combining <code>this</code> and/or <code>$(this)</code> with selectors. A future blog post exploring this topic would be greatly appreciated for us beginners!  <img src='http://www.learningjquery.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Warters</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-9846</link>
		<dc:creator>Bill Warters</dc:creator>
		<pubDate>Tue, 14 Aug 2007 21:02:35 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-9846</guid>
		<description>Got it sorted...Here's the selector I needed, placed in the code where the alert now sits.
&lt;code&gt;
$("span#"+spanid+".favorites_span").html(data);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Got it sorted&#8230;Here&#8217;s the selector I needed, placed in the code where the alert now sits.<br />
<code><br />
$("span#"+spanid+".favorites_span").html(data);<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Warters</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-9839</link>
		<dc:creator>Bill Warters</dc:creator>
		<pubDate>Tue, 14 Aug 2007 18:44:15 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-9839</guid>
		<description>Oops, I thought Karl posted this...I don't recall Mike being at BarCamp GrandRapids.</description>
		<content:encoded><![CDATA[<p>Oops, I thought Karl posted this&#8230;I don&#8217;t recall Mike being at BarCamp GrandRapids.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Warters</title>
		<link>http://www.learningjquery.com/2007/08/what-is-this#comment-9818</link>
		<dc:creator>Bill Warters</dc:creator>
		<pubDate>Tue, 14 Aug 2007 06:18:51 +0000</pubDate>
		<guid>http://www.learningjquery.com/2007/08/what-is-this#comment-9818</guid>
		<description>Hi there. I got interested in trying out jQuery after seeing your session at the Grandrapids BarCamp. Right now, however, I'm stumped trying to get my selectors straight...I guess this is just not what it seems.

Briefly, I've got a blog setup I'm building that I'd like to add an "Add to favorites" feature to. I can submit the query and get back the data string I'm looking for, but I can't figure out how to select the span that my trigger link resides within so that I can replace it's html with the returned data.

Sample blog html snippet
&lt;code&gt;
&#60;h2&#62;A Sample Posting to the Blog&#60;/h2&#62;
&#60;p class="postedby"&#62;Posted by &#60;a href="/forums/member/1/"&#62;Fred&#60;/a&#62; on  Aug 03, 2007 &#160;
&#60;span class="favorites_span" id="favorite_1750"&#62;
&#60;a class="Favorites_Trigger" id="1750" href="/forms/favorite-add/1750"&#62;Add to favorites?&#60;/a&#62;
&#60;/span&#62;
&#60;/p&#62;
&#60;p&#62;Here is a sample posting in the  blog. This could be written by an expert in the area.
&#60;/p&#62;
&lt;/code&gt;

And here's the bit of Jquery code that I can't quite get to replace my favorites span contents. 
&lt;code&gt;
&#60;script type="text/javascript" src="includes/jquery"&#62;&#60;/script&#62;
&#60;script type="text/javascript"&#62;
$().ready(function() {
$('a.Favorites_Trigger') .click (function() {
var itemid = this.id;
$.get(this.href, function(data) {
var myresponse = data;
var spanid = "favorite_" + itemid;
alert(data);
});
return false;
});
});
&#60;/script&#62;
&lt;/code&gt;

Should I be trying to get the parent of my trigger link, and if so, how do I get there from "this"?
As you can see, I can even construct the unique span id I'm looking for based on the link id, but my javascript skills are not up to the task of using this variable correctly in a jquery select statement. 
Any help would be much appreciated...</description>
		<content:encoded><![CDATA[<p>Hi there. I got interested in trying out jQuery after seeing your session at the Grandrapids BarCamp. Right now, however, I&#8217;m stumped trying to get my selectors straight&#8230;I guess this is just not what it seems.</p>
<p>Briefly, I&#8217;ve got a blog setup I&#8217;m building that I&#8217;d like to add an &#8220;Add to favorites&#8221; feature to. I can submit the query and get back the data string I&#8217;m looking for, but I can&#8217;t figure out how to select the span that my trigger link resides within so that I can replace it&#8217;s html with the returned data.</p>
<p>Sample blog html snippet<br />
<code><br />
&lt;h2&gt;A Sample Posting to the Blog&lt;/h2&gt;<br />
&lt;p class="postedby"&gt;Posted by &lt;a href="/forums/member/1/"&gt;Fred&lt;/a&gt; on  Aug 03, 2007 &nbsp;<br />
&lt;span class="favorites_span" id="favorite_1750"&gt;<br />
&lt;a class="Favorites_Trigger" id="1750" href="/forms/favorite-add/1750"&gt;Add to favorites?&lt;/a&gt;<br />
&lt;/span&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;Here is a sample posting in the  blog. This could be written by an expert in the area.<br />
&lt;/p&gt;<br />
</code></p>
<p>And here&#8217;s the bit of Jquery code that I can&#8217;t quite get to replace my favorites span contents.<br />
<code><br />
&lt;script type="text/javascript" src="includes/jquery"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
$().ready(function() {<br />
$('a.Favorites_Trigger') .click (function() {<br />
var itemid = this.id;<br />
$.get(this.href, function(data) {<br />
var myresponse = data;<br />
var spanid = "favorite_" + itemid;<br />
alert(data);<br />
});<br />
return false;<br />
});<br />
});<br />
&lt;/script&gt;<br />
</code></p>
<p>Should I be trying to get the parent of my trigger link, and if so, how do I get there from &#8220;this&#8221;?<br />
As you can see, I can even construct the unique span id I&#8217;m looking for based on the link id, but my javascript skills are not up to the task of using this variable correctly in a jquery select statement.<br />
Any help would be much appreciated&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
