Is it possible to select multiple elements using an array selector?
If so, what is the best way to do it? In my project, I need to use only array selectors.
This is my sample code:
<ul>
<li>1<li>
<li>2<li>
<li>3<li>
<li>4<li>
<li>5<li>
</ul>
<a href="#">select</a>
$('a').click(function(){
var element = $('ul').find('li')[0]; // Instead is it possible $('ul').find('li')[0,3,4]? I know we can select finding each alone. But is there any shortcut?
$(element).css({border:'1px solid red'});
})
Arrayobject. See my answer to get more details.