jQuery w3schools 한글판 강좌62-jQuery - Dimensions-jQuery width() and height() Methods
jQuery w3schools 한글판 강좌62-jQuery - Dimensions-jQuery width() and height() Methods
jQuery width(), height() 메소드
width() 메소드는 요소의 폭값(패딩, 보더와 마진은 제외한)을 설정 또는 반환합니다.
height() 메소드는 요소의 높이값(패딩, 보더와 마진은 제외한)을 설정 또는 반환합니다.
다음 예는 지정된 <div> 요소의 폭과 높이값을 반환합니다.
Example
$("button").click(function(){
var txt = "";
txt += "Width: " + $("#div1").width() + "</br>";
txt += "Height: " + $("#div1").height();
$("#div1").html(txt);
});
var txt = "";
txt += "Width: " + $("#div1").width() + "</br>";
txt += "Height: " + $("#div1").height();
$("#div1").html(txt);
});
|
댓글을 작성하시려면 로그인이 필요합니다.
로그인