Friday, November 28, 2008

[jQuery] Re: Executing multiple actions on the same selection

yes.  jQuery supports method chaining.

$(a).hide().addClass();

see "Chainability" at http://docs.jquery.com/How_jQuery_Works

On Fri, Nov 28, 2008 at 12:26 PM, flycast <eric@janasnyder.com> wrote:

In some other languages I have had experience with one can use the
following pattern...

object [
.doThis()
.andThis()
.andAlsoThis()
]

Is there a way to do this with jQuery?

$(a){
.hide();
.addClass();
}

***Instead of ***
$(a).hide();
$(a).addClass();



--
I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.

No comments: