views:

45

answers:

2

I want to write a user script that runs some custom JS on each <input type="password"> field that gets loaded. I could register an event handler on document load to look for all input fields and run the JS on them, but that means firstly that the JS won't run on input fields that subsequently get added by other JS, and secondly it won't run until the page is fully loaded.

I want to put ChromaHash into all of my password fields.

+2  A: 

The jQuery livequery library could do this for you. It would look like this:

$('input').livequery(function() {
  doSomethingToTheInput(this); //this == the input
});
nicholaides
Thanks! That looks like exactly what I want.Totally impressed with StackOverflow, this being my first question here and it having been answered in under 15 minutes.
nornagon
A: 

The featuers of the livequery plugin where integrated into the latest jQuery you can now use them by calling live().

Example:

powtac
I don't think jQuery's .live() function supports the "load" event... at least, it doesn't seem to be listed on http://docs.jquery.com/Events/live
nornagon
ok, forget about the example.
powtac