Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

javascript - Wht is wrong with my code? How to get my new value

I have a form and calculation formula. I need to get my result in inpute string.

my table

<table class="vel_sum_table" style="font-size: 9pt;">
        <tr>
            <td><?php echo __( 'In package м<sup>2</sup>:', 'wqc' ); ?></td>
            <td> <span><?php echo number_format((get_post_meta($post->ID,"_calculatorscript_value",true)),2,",",""); ?> </span>
            </td>
        </tr>
        <tr>
            <td><?php echo __( 'Total:', 'wqc' ); ?></td>
            <td><input type="text" value="" name="quantity2" id="quantity_product_input" disabled style="border: none;color: #000;font-weight: bold;"/> 
            </td>
        </tr>           
    </table>

I need to get my result in quantity_product_input inpute. My script, I think, works. input[name=quantity] are on the page. It is product page woocommerce.

<script>
jQuery(document).ready(function($){
    var pakket_variable = <?php echo $calculatorValue; ?>;
     $('input[name=quantity]').on( 'input change', function(){
     var productQty   =  $(this).val() == '' ? 1 : $(this).val();
        meterM2 = (pakket_variable * productQty);
        $('#quantity_product_input').val(meterM2);
        }
    }}
</script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...