I am trying to calculate results on textfields. I have two textfields and when someone enter value like 3 or 4
on first textfield it generate result on second textfield.I am also trying that if someone try to enter values on second one then it will show result on first one.It works fine for first condition but not for second.My code is below .My second textfield not allowing me to change value.
<script type="text/javascript">
jQuery(function(jQuery) {
jQuery('.product-custom-option').on('keyup', function() {
var total = jQuery('.product-custom-option').val();
var perunit = 3;
var newprice = total/perunit;
jQuery('#no_packs').val(Math.ceil(newprice));
});
});
jQuery(function(jQuery) {
jQuery('#no_packs').on('keyup', function() {
var total = jQuery('#no_packs').val();
var perunit = 3;
var newprice = total * perunit;
jQuery('.product-custom-option').val(newprice);
});
});
</script>
HTML :
<dl class="last">
<dt>
</dt><dt><label class="required"><em>*</em>Square meters required</label>
</dt>
<dd class="last">
<div class="input-box">
<input type="text" onchange="opConfig.reloadPrice()" id="options_134_text" class="input-text required-entry product-custom-option" name="options[134]" value="">
</div>
</dd>
</dl>
<div class="">
<label class="required">Number of Packs</label>
<div class="input-box">
<input type="text" id="no_packs" class="input-text product-custom-option" name="qty" value="">
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire