开发者

javascript - document.activeElement

开发者 https://www.devze.com 2023-01-03 06:11 出处:网络
I have a few inputTextBoxes and I\'m using document.activeElement to handle value changes of those inputboxes called by \"change()\" function of inputBox element.

I have a few inputTextBoxes and I'm using document.activeElement to handle value changes of those inputboxes called by "change()" function of inputBox element.

the problem is when I change the value of one of the inputboxes and then click in another inputbox... the function 开发者_开发知识库will get the document.activeElement of the new inputbox and will not work... how to make the function "know" that the one that changed was the previous one?


In an element's change() handler, the keyword this will refer to the element which was just changed.

$('#foo').change(function() {
    alert(this.id);  // "foo"
});


actually it worked!!

I changed from:

editBoxAtual = document.activeElement;

to

editBoxAtual = this;

it worked incredible well! thanks

0

精彩评论

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