Calculate salary hike program with HTML, javascript & jQuery

Views: 67   

Demo

Code

<html>
<head>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> </script>
<script>
$(document).ready(function(){
$("#newsalary").click(function(){
    var n = $("#oldsal").val();
    var x = $("#persentage").val();
    $("#result").val((+n) + ((+n)*(+x)) / 100)
});
});
</script>
</head>
<body>
<div>
Enter your old salary:
<input type = "text" id = "oldsal"><br><br>
Enter your hike persentage:
<input type = "text" id = "persentage"><br><br>
<button type = "button" id = "newsalary">Newsalary</button><br><br>
Result:
<input type = "text" id = "result">
</div>
</body>
</html>
On By