Setting width as a percentage using jQuery

Viewed 122464

How can I set the width of a div as a percentage using jQuery?

3 Answers

Using the width function:

$('div#somediv').width('70%');

will turn:

<div id="somediv" />

into:

<div id="somediv" style="width: 70%;"/>
Related