onfocus with select box in scriptaculous

Posted by Stacia on Stack Overflow See other posts from Stack Overflow or by Stacia
Published on 2010-04-13T23:58:49Z Indexed on 2010/04/14 0:03 UTC
Read the original article Hit count: 494

I have some code like so:

$('product_name').onfocus=function() {
     this.focused=true;
};
$('product_name').onblur=function() {
     this.focused=false;
 }


function getEnter(evt){
    if (evt.keyCode == Event.KEY_RETURN) {

        if ($('product_name').focused ) {
        ...

However, if I try to add this to a select box and change the function to an ||, it breaks. Do select boxes work differently since they can be continuously selected? .focus seemed to make a difference (brighter color when in focus).

I am trying to do a search on enter if either the product_name or the select box is focused and do something else otherwise. I have it set up now so everything works except the select box. Thanks.

© Stack Overflow or respective owner

Related posts about scriptaculous

Related posts about select