FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 558   



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
       $("#mul").click(function(){
        var a = $("#width").val();
        var b = $("#height").val();
         $("#result").val ((+a) * (+b));
    });

   //Circumference 
   $("#add").click(function(){
   var a = $("#width").val();
   var b  = $("#height").val();
   $("#result").val (2 *(+a) + 2 * (+b));
   });
});
</script>
</head>
<body>
<div>
Enter width value:
<input type = "text" id = "width"><br><br>
Enter height value:
<input type = "text" id = "height"><br><br>
Result:
<input type = "text" id = "result"><br><br><br>
<button type = "button" id = "mul"> Area</button>
<button type = "button" id = "add"> Circumference</button>
</div>
</body>
</html>



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News