On Nov 10, 2007, at 9:58 PM, [EMAIL PROTECTED] wrote:


hi everyone
i am a newbee for jquery and trying to play with it, i was puzzled by
the use of this somehow, for examle
$('.delete').click(function(){
       $.post("test2.php",{id:txt},function(){
                this.something};});
here if i want to refer this to the $('.delete') element, what shall i
write?
in debugger i found this refers to the function body.


You could try this:

$('.delete').click(function(){
var $thisDelete = $(this); // $thisDelete is now a jQuery object wrapping the clicked element
                                                        // useful for attaching 
jQuery methods, chaining, etc.
       $.post("test2.php",{id:txt},function(){
                $thisDelete.somejQueryMethod();
        });
});

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to