jQuery

[ETC] JQ - 자식요소 너비를 부모요소 너비로 설정. (= 너버를 부모요소에 꽉차게 설정.)

예제 - input 입력창 너비를 부모요소에 꽉 차게 설정.

 

<script src="http://code.jquery.com/jquery-latest.js"></script>


<div style="border:1px solid red; width 500px;">

   <input type="text" value="홈짱닷컴 Homzzang.com">

</div>


<script>

$(document).ready(function() {

    for(i=0; i < $("input[type=text]").length; i++){

        tempObj = $("input[type=text]").get(i);

        $(tempObj).outerWidth($($(tempObj).parent()).innerWidth());

    }

});

</script>

 

결과보기

 


분류 제목
ETC JQ - fakeLoader(페이크로더) 효과 + 이미지 랜덤 인트로 페이지
ETC JQ - <li> 높이를 LI 요소 중 최대높이에 맞추기 설정 (= 가장 긴/높은 높이에 맞추기 = 높이 정…
ETC JQ - Uncaught TypeError: Cannot read properties of undefined…
2/2
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱닷컴 PC버전 로그인