테스트 사이트 - 개발 중인 베타 버전입니다

쇼핑몰 클릭 수량조절

· 16년 전 · 3399 · 2
<input type=text name='ct_qty' id='ct_qty' value='1' size=4 maxlength=4 class=ed autocomplete='off' style='text-align:right;' onkeyup='calc_amount()'>
<img src='img/qty_control.gif' border=0 align=absmiddle usemap="#qty_control_map"> 개
<map name="qty_control_map">
<area shape="rect" coords="0, 0, 10, 9"   id='qty_plus'>
<area shape="rect" coords="0, 10, 10, 19" id='qty_minus'>
</map>

... 중략 ...


<script>
// 위,아래 이미지 클릭으로 수량 조절
$(document).ready(function() {
    var $this = $('#ct_qty');
    $('#qty_plus').click(function() {
        if (isNaN(parseInt($this.val()))) {
            $this.val(1);
        }
        else {
            $this.val(parseInt($this.val()) + 1);
        }
    }).css('cursor', 'pointer');

    $('#qty_minus').click(function() {
        if (isNaN(parseInt($this.val()))) {
            $this.val(1);
        }
        else {
            $this.val(parseInt($this.val()) - 1);
            if ($this.val() < 1) $this.val(1);
        }
    }).css('cursor', 'pointer');
});
</script>

[이 게시물은 관리자님에 의해 2011-10-31 16:55:28 jQuery에서 이동 됨]

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 2개

15년 전
좋은 정보 감사드려요
적용해 보아야겠네요
15년 전
http://sir.co.kr/bbs/board.php?bo_table=tip_jquery&wr_id=12&sca=&sfl=&stx=&spt=0&page=5
웹자인님 그만쫌 하시죠.. 포인트가 중요하시면 커뮤니티를 하세요
참 보기 않좋네요

게시글 목록

번호 제목
20097
20095
20093
20092
20091
20089
20086
20085
20084
20083
20082
28358
20081
20079
20078
20077
20076
20075
20074
20073
20072
20071
20070
20069
8148
20057
8141
24669
20056
8138
28353
20055
20054
20053
20052
20051
20050
20047
20046
20045
20044
8111
20043
20042
20040
20039
20037
20036
20035
20027
8107
31022
20026
20025
20024
20023
28350
20022
20018
20017
8099
20016
20013
8090
20012
20010
20009
19998
28348
28347
19997
19996
19995
19993
8087
8065
19990
8063
8056
19989
19988
19987
19986
19985
19984
19983
19982
8054
19981
19980
19979
19978
19977
19976
19975
19974
19973
19972
19971
19970