views:

189

answers:

1

Hello!

I am using the "Highlight Container" effect in the Dojo Toolkit (as shown here).

My problem comes when I have a DIV that contains a TEXTAREA instead of a text field. I am not sure how to get it to recognize either a text field or a textarea. The code function is as follows:

dojo.addOnLoad(function() {
  dojo.query(".container input[type=text]",
  dojo.byId("topLevel"))
.onfocus(function(evt){
  //Make the background light yellow when an input gets focus
    dojo.anim(getContainer(evt.target),{backgroundColor: "#FFFFCC"});
  })
.onblur(function(evt){
  //Restore the background when an input loses focus
    dojo.anim(getContainer(evt.target), {backgroundColor: "#FFFF66"});
  })

});

As you can see, it's second line where the text field is found. I guess looking for the textarea would go there as well, but I have no idea on the syntax.

Thanks for the help!

+1  A: 

Compound queries use commas:

dojo.query("input[type=text], textarea", ...
Alex Martelli
Thank you so much! :)
David, when an answer solves your problem, remember to accept it (use the checkmark icon below the number giving the up/down votes for the answer): that's fundamental SO etiquette!
Alex Martelli