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

값 넘겨주기 input 이렇게 쓰는게 맞을까요?

· 10년 전 · 761 · 1

        <tr>
            <th scope="row"><label for="wr_5">정가/할인율<strong class="sound_only">필수</strong></label></th>
            <td><input type="text" name="wr_5" class="box" value="<?php echo $wr_5 ?>" id="wr_5" required class="frm_input required" size="20" maxlength="20"> x
   <input type="text" name="wr_6" class="box" value="<?php echo $wr_6 ?>" id="wr_6" required class="frm_input required" size="10" maxlength="20"> %</td>
        </tr>

<script>
$(".box").onkeypress(function(){
var result=$("input[name='wr_5']").val()+$("input[name='wr_6']").val();
 $("input[name='wr_7'].val(result);//
});
</script>


        <tr>
            <th scope="row"><label for="wr_7">할인가<strong class="sound_only">필수</strong></label></th>
            <td><input type="text" name="wr_7" value="<?php echo $wr_7 ?>" id="wr_7" class="box" required class="frm_input required" size="10" maxlength="20"></td>
        </tr>​

 

 

5 번 6 번 값을 더해서 7번에 바로 보여주기 하고 싶은데요. 저렇게 해봤는데 안되서요.

 

댓글 작성

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

로그인하기

댓글 1개

괄호를 하나 안닫으셨네요.

게시글 목록

번호 제목
20841
20840
20839
20838
20835
20834
7057
19668
19667
19666
19665
19663
19662
19661
19660
19659
19658
19657
19656
19655
19654
19653
19652
19651
19650
19649
19648
19647
19646
19645
19644
19643
19642
19641
19640
19639
19638
19637
19636
7051
26561
19635
19634
27958
30952
27955
19633
19632
19631
7048
7033
19630
7021
7018
27953
7015
27951
7011
19628
19627
7010
27947
7009
19626
19625
24635
7005
27943
7000
19624
6995
6992
30949
30948
19623
19620
19619
6990
6986
27940
30947
30945
19618
19617
19616
19615
19614
19613
19612
19610
30943
30942
19609
19608
19607
24631
27935
27933
24628
19604