Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72388

How can I use IF condition for calculated value in my HTML query?

$
0
0

I am new in Query and I want to make my function use IF condition, I mean if the input value more than 130 use this calculation

 $('#totalprice3').text(((val1+(val1*9) / 100) * 3.75) + 500);

instead of

 $('#totalprice3').text(((val1+(val1*9) / 100) * 3.75) + 338);

Here is my code:

    $(function () {
        $("input[name=SAR]").on('keyup', function () {
            $('#SAR2').html($(this).val());
            var val1= parseInt($("input[name='SAR']")[0].value);

            $('#totalprice3').text(((val1+(val1*9) / 100) * 3.75) + 338);
        });
    });
<!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/bootstrap/css/bootstrap.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/fonts/font-awesome-4.7.0/css/font-awesome.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/fonts/iconic/css/material-design-iconic-font.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/animate/animate.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/css-hamburgers/hamburgers.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/animsition/css/animsition.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/select2/select2.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/daterangepicker/daterangepicker.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/vendor/noui/nouislider.min.css"><!--===============================================================================================--><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/css/util.css"><link rel="stylesheet" type="text/css" href="http://outlet.sa/form/css/main.css"><!--===============================================================================================--><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><div class="container-contact100"><div class="wrap-contact100"><form class="contact100-form validate-form" method='post' action="add.php" enctype= "multipart/form-data"><span class="contact100-form-title"></span><div class="wrap-input100 validate-input bg1 rs1-wrap-input100" data-validate = "This field is required"><span class="label-input100"> Price is :</span><input id="theText" class="form-control" type="number" pattern="[0-9]*" inputmode="numeric" name="SAR" placeholder="0" /></div><br /><div class="wrap-input100 bg1 rs1-wrap-input100"><span class="label-input100">Total:</span><br /><span hidden id="SAR2">0</span><span id="totalprice3">0</span> <br /></div></form></div></div>

Thank you,


Viewing all articles
Browse latest Browse all 72388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>