回答編集履歴
4
変更
    
        answer	
    CHANGED
    
    | @@ -3,15 +3,16 @@ | |
| 3 3 | 
             
            ```jQuery
         | 
| 4 4 | 
             
            <script>
         | 
| 5 5 | 
             
              $(function() {
         | 
| 6 | 
            +
                var tmp = parseInt($(this).text());
         | 
| 6 7 | 
             
                $('.box').on('click',function() {
         | 
| 7 | 
            -
                  if (  | 
| 8 | 
            +
                  if ( tmp < 上限値 ) {
         | 
| 8 | 
            -
                    $(this).text( | 
| 9 | 
            +
                    $(this).text(tmp + 1);
         | 
| 9 10 | 
             
                  }
         | 
| 10 11 | 
             
                });
         | 
| 11 12 |  | 
| 12 13 | 
             
                $('.box').on('contextmenu',function(){
         | 
| 13 | 
            -
                  if (  | 
| 14 | 
            +
                  if ( tmp > 下限値 ) {
         | 
| 14 | 
            -
                    $(this).text( | 
| 15 | 
            +
                    $(this).text(tmp - 1);
         | 
| 15 16 | 
             
                  }
         | 
| 16 17 | 
             
                });
         | 
| 17 18 | 
             
              });
         | 
3
訂正
    
        answer	
    CHANGED
    
    | @@ -4,14 +4,14 @@ | |
| 4 4 | 
             
            <script>
         | 
| 5 5 | 
             
              $(function() {
         | 
| 6 6 | 
             
                $('.box').on('click',function() {
         | 
| 7 | 
            -
                  if ( parseInt($(this).text())  | 
| 7 | 
            +
                  if ( parseInt($(this).text()) < 上限値 ) {
         | 
| 8 | 
            -
                    $(this).text(parseInt($(this).text())  | 
| 8 | 
            +
                    $(this).text(parseInt($(this).text()) + 1);
         | 
| 9 9 | 
             
                  }
         | 
| 10 10 | 
             
                });
         | 
| 11 11 |  | 
| 12 12 | 
             
                $('.box').on('contextmenu',function(){
         | 
| 13 | 
            -
                  if ( parseInt($(this).text())  | 
| 13 | 
            +
                  if ( parseInt($(this).text()) > 下限値 ) {
         | 
| 14 | 
            -
                    $(this).text(parseInt($(this).text())  | 
| 14 | 
            +
                    $(this).text(parseInt($(this).text()) - 1);
         | 
| 15 15 | 
             
                  }
         | 
| 16 16 | 
             
                });
         | 
| 17 17 | 
             
              });
         | 
2
訂正
    
        answer	
    CHANGED
    
    | @@ -5,13 +5,13 @@ | |
| 5 5 | 
             
              $(function() {
         | 
| 6 6 | 
             
                $('.box').on('click',function() {
         | 
| 7 7 | 
             
                  if ( parseInt($(this).text()) > 下限値 ) {
         | 
| 8 | 
            -
                    $(this).text(parseInt($(this).text())  | 
| 8 | 
            +
                    $(this).text(parseInt($(this).text()) - 1);
         | 
| 9 9 | 
             
                  }
         | 
| 10 10 | 
             
                });
         | 
| 11 11 |  | 
| 12 12 | 
             
                $('.box').on('contextmenu',function(){
         | 
| 13 13 | 
             
                  if ( parseInt($(this).text()) < 上限値 ) {
         | 
| 14 | 
            -
                    $(this).text(parseInt($(this).text())  | 
| 14 | 
            +
                    $(this).text(parseInt($(this).text()) + 1);
         | 
| 15 15 | 
             
                  }
         | 
| 16 16 | 
             
                });
         | 
| 17 17 | 
             
              });
         | 
1
誤記訂正
    
        answer	
    CHANGED
    
    | @@ -4,13 +4,13 @@ | |
| 4 4 | 
             
            <script>
         | 
| 5 5 | 
             
              $(function() {
         | 
| 6 6 | 
             
                $('.box').on('click',function() {
         | 
| 7 | 
            -
                  if ( $(this).text() > 下限値 ) {
         | 
| 7 | 
            +
                  if ( parseInt($(this).text()) > 下限値 ) {
         | 
| 8 8 | 
             
                    $(this).text(parseInt($(this).text()) + 1);
         | 
| 9 9 | 
             
                  }
         | 
| 10 10 | 
             
                });
         | 
| 11 11 |  | 
| 12 12 | 
             
                $('.box').on('contextmenu',function(){
         | 
| 13 | 
            -
                  if ( $(this).text() < 上限値 ) {
         | 
| 13 | 
            +
                  if ( parseInt($(this).text()) < 上限値 ) {
         | 
| 14 14 | 
             
                    $(this).text(parseInt($(this).text()) - 1);
         | 
| 15 15 | 
             
                  }
         | 
| 16 16 | 
             
                });
         | 
