Sum Of Two Numbers
Short and sweet application. On submitting the form a, b values are passed to self(same page) using GET method. On reload the JS fetches values of a & b from URL using getUrlParameter Method and computes there sum.
Code
$(document).ready(function(){
var a = getUrlParameter("a");
var b = getUrlParameter("b");
if(a!="" && b!=""){
if($.isNumeric(a) && $.isNumeric(b)){
$("#output").html(+a + +b);
}
else $("#output").html("Enter only numbers.");
}
else $("#output").html("Please fill the input and hit add button.");
});
-
Previous -
Next
This website is made possible by displaying online advertisements to our visitors.
Please consider supporting by disabling your ad blocker.
Please consider supporting by disabling your ad blocker.
loading comments...