FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 617   



Demo

Code

<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
    </script>
    <script>
        $(document).ready(function() {
            //Area
            $("#area").click(function() {
                var a = $("#width").val();
                $("#result").val((+a) * (+a));
            });
            //Circumference
            $("#circumference").click(function() {
                var a = $("#width").val();
                $("#result").val(4 * (+a));
            });
        });
    </script>
</head>
<body>
    <div>
        Enter width value:
        <input type="text" id="width"> <br><br>
        <button type="button" id="area"> Area </button>
        <button type="button" id="circumference"> Circumference </button><br><br><br> Result:
        <input type="text" id="result">
    </div>
</body>
</html>



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News