Calculate salary hike program with HTML, javascript & jQuery

2890


Demo

<iframe height='265' scrolling='no' title='RZgYQw' src='//codepen.io/fastfoodcoding/embed/RZgYQw/?height=265&theme-id=light&default-tab=result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https://codepen.io/fastfoodcoding/pen/RZgYQw/'>RZgYQw</a> by fastfoodcoding (<a href='https://codepen.io/fastfoodcoding'>@fastfoodcoding</a>) on <a href='https://codepen.io'>CodePen</a>. </iframe>

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>