Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A jQuery plugin that automatically applies jQuery methods to elements that are dynamically added to the page
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
README.textile
jquery.always.js

README.textile

jquery-always

What is it?

A jQuery plugin that automatically applies jQuery methods to elements that are dynamically added to the page.

Methods

always()

All subsequent method calls in the chain (such as ‘click’, ‘addClass’, or any other jQuery method, built-in or custom) get applied both immediately and whenever new content is added dynamically.

How do I use it?

Let’s say you have a click handler defined like this:

$('.do_something').click(function() { alert('something') });

If you want to make sure that elements added dynamically also receive the ‘click’ method, use always():

$('.do_something').always().click(function() { alert('something') });

Any content added to the page will handled automatically:

$('body').append('<a href="#" class="do_something">click me</a>');

requires jQuery 1.3

Isn’t this the same as livequery?

It’s very similar but with fewer features and a modified API. I certainly got a lot of inspiration from livequery. My goal with this is to meet the same need that livequery met for me with a more simplified API and without the features I didn’t need.

Something went wrong with that request. Please try again.