开发者

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:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜