[jQuery] Binding in jQuery
Ok, so I know that the Prototype `bind` method isn't the correct way
to go about things in jQuery. The problem is I don't know what the
correct way is…So, I offer up an example:
$(document).ready(function(){
$('h2.countdown[paused="no"]').each(function(){
this.update = function()
{
this.innerHTML = 'stuff';
}
this.interval = setInterval(this.update, 1000);
});
});
The idea here is that every second the update function runs on the
selected h2's. Meaning every second a function call should be
triggered with the h2 as the scope. Is this not possible or even the
correct way to do this? How should I do this in jQuery?