[jQuery] jQuery and OOP

[jQuery] jQuery and OOP

Mike's approach can be expanded to a complex ajax application. Closures and
element properties are natural ways to associate instance data with elements
in jQuery.
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of Kolman Nándor
Sent: Tuesday, October 24, 2006 10:49 AM
To: jQuery Discussion.
Subject: Re: [jQuery] jQuery and OOP
That is really nice and handy you wrote :), but I am writing a complex ajax
application. I just created a simple scenario to show what I want. So yes, I
really need it.
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of Michael Geary
Sent: Tuesday, October 24, 2006 4:23 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] jQuery and OOP
Do you really need an object at all? This (pun intended) would do the same
thing as all the code you listed:
$(function() {
var $btn = $('#btnCounter'), nr = 0;
$btn.click( function() {
$btn.attr( 'value', nr++ );
});
});
-Mike