20 lines
517 B
JavaScript
20 lines
517 B
JavaScript
|
create_listener = function(elem) {
|
||
|
var listener = function() {
|
||
|
elem.value = '';
|
||
|
elem.removeEventListener('focus', listener, false);
|
||
|
};
|
||
|
return listener;
|
||
|
}
|
||
|
|
||
|
prepare_delete_onfocus = function() {
|
||
|
var elems, elemI, elem, listener;
|
||
|
elems = document.getElementsByClassName('deleteonfocus');
|
||
|
for (elemI in elems) {
|
||
|
elem = elems[elemI];
|
||
|
elem.addEventListener('focus', create_listener(elem), false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.onload = function(event) {prepare_delete_onfocus();}
|
||
|
|