$(this).closest('li'); 이게 이해하는게 너무 어렵네요 ㅠ,ㅠ
본문
<div style="float:right;">
<input type="text" id="buy_count_0" value="1"class="simpleform" onkeyup="함수.countBuy('keyup',this)" onblur="함수.countBuy('blur',this)">
<div>
<a style="display:block" onclick="함수.countBuy('up',this)"><img src="/template/shop/images/arrow_up.gif"></a> // countBuy 함수 동작을 위해 클릭한다!
</div>
<span>개 <span class="option_price"><span id="price_item">{=number_format(goods.price_sell)}</span>원</span></span>
</div>
<script type="text/javascript">
countBuy = fucntion(mode , this){
var li = $(this).closest('li'); // 여기서 나오는 제이쿼리 closest 뜻을 알고 싶습니다.
var input = li.find('input');
var cnt = input.val();
}
</script>
onclick을 하게되면 자바스크립트 countBuy함수에서 this을 받아올텐데요
그런데 여기서 제이쿼리 closest을 이용해요 li태그 이것을 찾는 의미 인가요?
찾더라도 받아온 this는 a태그밖에 못가져올텐데요...
왜 li라고 적혀져 있는지 모르겠습니다 ㅠ,ㅠ
제이쿼리 closest 역활을 알기 쉽게 알고 싶네요 ㅠ,ㅠ 인터넷 뒤져봐도 이해가 안되서 이렇게
글로 문의 드립니다.
부탁드립니다 ㅠ,ㅠ
!-->
답변을 작성하시기 전에 로그인 해주세요.