onfocus with select box in scriptaculous
- by Stacia
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.