in

woocommerce measurement price calculator – increase measure imput value by speficic % on a button click


On a site that sells wood floors by the box, I’d need to add on option to add a % of extra material that is recommended, by increasing the area needed value. Unfortunately I can’t provide you with a link as it’s now currently under a coming soon page so I figured I’d provide you with the HTML:

<table id="price_calculator" class="wc-measurement-price-calculator-price-table simple_price_calculator quantity-based-mode">

   <tbody><tr class="price-table-row area-input">

            <td>
                <label for="area_needed">
                    Superficie richiesta (mm^2) 
                </label>
            </td>

            <td style="text-align:right;">
            <span class="dashicons dashicons-editor-help wc-measurement-price- 
            calculator-input-help tip" title="false"></span>
                <input type="text" name="area_needed" id="area_needed" 
            class="amount_needed" data-unit="sq mm" data-common-unit="sq m" 
            autocomplete="off">
            </td>
            </tr>
    
   </tbody></table>

What i’ve tried so far is this snippet that adds specific value to the area needed label and it works:

<a id="quantityincrease" class="button" href="#">150</a>
<script>
jQuery( function($) {
$('#quantityincrease').click( function(e) {
    e.preventDefault();
    $('[name="area_needed"]').val('150');
    console.log('#quantityincrease was clicked');
});
});
</script>

What I need is that button to increase the value in the area_needed label by a specific percentage. Thanks in advance to anyone who will try to help.



Source: https://stackoverflow.com/questions/70540805/woocommerce-measurement-price-calculator-increase-measure-imput-value-by-spefi

Jenkins CLI allows you manage your Jenkins as an easy way

4G Networks in India Still Important to Focus in 2022