149
rated 0 times
[
152]
[
3]
/ answers: 1 / hits: 41935
/ 15 Years ago, thu, may 21, 2009, 12:00:00
Is it possible to have focus events bubble in protoype?
I am trying to prevent having to assign an observer on every input element.
<script language=javascript type=text/javascript>
document.observe('dom:loaded', function() {
// Doesn't work
$('editForm').observe('focus', function(evnt){
console.log('FOCUS!');
});
// Works
$('editForm').select('INPUT').each(function(elem) {
elem.observe('focus', function(evnt){
console.log('FOCUS!');
});
});
});
</script>
<form method=post name=editForm id=editForm action=>
<input type=text name=foobar />
</form>
More From » prototypejs