Add plus-minus quantity increment in WooCommerce

/* http://wcodex.co.in/add-plus-minus-quantity-increment-woocommerce-store/
woocommerce/global/quantity-input.php */
<div class="quantity">
  <input class="minus" type="button" value="-">
  <input type="number" ... size="4" />
  <input class="plus" type="button" value="+">
</div>
/* CSS */
input[type="number"] {
    -moz-appearance: textfield;
}
.minus {
    border:none;
    color:#fff;
    background-color:purple;
    height:30px;
    width:30px;
}
.plus {
    border:none;
    color:#fff;
    background-color:purple;
    height:30px;
    width:30px;
}
.qty {
    border:1px solid purple;
    color:purple;
    height:30px;
     
}
/* JS */
jQuery(document).ready(function($){
        $('.quantity').on('click', '.plus', function(e) {
            $input = $(this).prev('input.qty');
            var val = parseInt($input.val());
            $input.val( val+1 ).change();
        });
 
        $('.quantity').on('click', '.minus', 
            function(e) {
            $input = $(this).next('input.qty');
            var val = parseInt($input.val());
            if (val > 0) {
                $input.val( val-1 ).change();
            } 
        });
    });