My Javascript won’t work in WordPress

I created a script for a basic HTML/CSS page I programmed a while ago, it works fine in a standard website but when I try and import it into my client’s new WordPress Website the script doesn’t work.

New Website: http://www.fencingfabrication.com.au/quote-calculator/

HTML

*<h1>S & N Fencing</h1>
        <h2>Get a fencing quote today</h2>
        <h4>Requires browser Javascript</h4>
        <h3>Gate dimenstions</h3>
        Wood Look 10% extra<input type="checkbox"  id="check1" value=false><br>
        <p>Length in mm</p><input id="a" type="text"/>
        <p>Width in mm</p><input id="b" type="text"/>
        <br><br><br>

        <input type="button" onclick="val()" value="Calculate Total"/>*


<script type="text/javascript"> 
    var a,b;    /*creates variables a and b*/

    var gatePrice = 500; /*price per square meter of fencing*/

    function setValues() /*assigns value of a and b using id*/
    {
        a = Number(document.getElementById("a").value); 
        b = Number(document.getElementById("b").value);

    }

    function check_tenpercent(checkbox) /*checks if check boxes are checked and adds assigns values to variable*/
    {
        var retval = 1;
        if(checkbox.checked == true)
        {
            retval = 1.1;
        }
        return retval;
    }

    function val()
    {
        setValues();
        var rate1 = check_tenpercent(document.getElementById("check1"));


        gateMeters = a*b / 1000000;

        gateMeters = gateMeters * rate1;

        gateMeters = gateMeters * gatePrice;


        result = gateMeters;
        if(result >= 700){
        alert("The total fencing price for this job is" + " $" + result.toFixed(2)); /*gives out total price of fencing*/
        }else {
            alert("This job would cost" + " $" + result.toFixed(2) + ". " + "Minimum price is $700");
        }
    }
</script>

Read more here: My Javascript won’t work in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *