How can i do multiples selectors in yui (yui 2) like in jquery :
$('h1, h2, el1, el2, .content, .title').css('color', 'red');
How can this one be written in yui (without doing YAHOO.util.Dom.addClass on each element seperately)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Some of the DOM methods of YUI accept an array of elements to act on, and the addStlye() method is one of them, so you should be able to do:
Think it only works with ids though, so the first element should have an id of el1, etc…
EDIT:
You can also use the
YAHOO.util.Selectormodule to query the DOM and return the array of elements to pass tosetStyle(), e.g: