idがleft-sideの要素の幅を100pxにする。
$( '#left-side' ).width( 100 );
$( '#left-side' ).attr( 'style', 'width:100px;' );
とほぼ同じ効果だが、width関数はほかのstyle属性の値を気にしなくていい。なお、左右のpadding値を含めた値を指定する場合は、outerWidth関数を使用する。
idがleft-sideの要素の幅を100pxにする。
$( '#left-side' ).width( 100 );
$( '#left-side' ).attr( 'style', 'width:100px;' );
とほぼ同じ効果だが、width関数はほかのstyle属性の値を気にしなくていい。なお、左右のpadding値を含めた値を指定する場合は、outerWidth関数を使用する。