user1856596
user1856596

Reputation: 7233

Prototype: Selecting an element with multiple classes?

I have that element:

<span class="class1 class2">...</span>

How can I select this elmement using both classes with Prototype JS? Like this maybe?

$$(span.class1.class2)

Thanks!

Upvotes: 2

Views: 953

Answers (2)

CodeWizard
CodeWizard

Reputation: 142094

you also have native browser support:

document.querySelector('span.class1.class2') 

which is faster then using any other wrapper.

Upvotes: 0

BoltClock
BoltClock

Reputation: 723598

Almost, you just forgot to put it in a string:

$$('span.class1.class2')

Upvotes: 2

Related Questions