UserScript: run JavaScript on password fields as they're loaded
I want to write a user script that runs some custom JavaScript code 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 JavaScript code on them, but that means firstly that the JavaScript 开发者_开发知识库code won't run on input fields that subsequently get added by other JavaScript code, and secondly it won't run until the page is fully loaded.
I want to put ChromaHash into all of my password fields.
The jQuery livequery library could do this for you. It would look like this:
$('input').livequery(function() {
doSomethingToTheInput(this); //this == the input
});
The featuers of the livequery plugin where integrated into the latest jQuery you can now use them by calling live()
.
Example:
精彩评论