Simulator88
Simulator88

Reputation: 637

Specify max width for all select in my form

I have a form with several selects (dropdown lists).

I want all of them to have max-width:300px, I tried this, but not working:

$(#myform 'select').css(width, '300px');

Upvotes: 0

Views: 100

Answers (2)

James Coyle
James Coyle

Reputation: 10398

In jQuery it should be:

$('#myform select').css('max-width', '300px');

And pure CSS:

#myform select{
    max-width:300px;
}

Upvotes: 2

Popnoodles
Popnoodles

Reputation: 28409

Your syntax is wrong

$('#myform select').css(width, '300px');

but in any case you would do this with pure CSS

#myform select{
    width:300px;
}

Upvotes: 3

Related Questions