Yisela
Yisela

Reputation: 6961

Style a multiple select box (but not a combo) in css

I need to style all the multiple select boxes of a page without using classes, but I don't want the styles to be applied to the combos in the same page. How do I call ONLY the multiple select?

HTML:

Apply styles to:

<select multiple> <option>option 1</option> <option>option 2</option> </select>

But not:

<select> <option>option 1</option> <option>option 2</option> </select>

I'm looking for something like input[type=text] but for the multiple. Thanks!

Upvotes: 0

Views: 4559

Answers (1)

Jared Farrish
Jared Farrish

Reputation: 49198

Use the attribute selector:

select[multiple]

As in:

$('select[multiple]').addClass('selected');

http://jsfiddle.net/Lw9bk/

Upvotes: 2

Related Questions