Project- Tip Calculator
<input type="number" name="" id="bill">
<select id="rating">
<option value="0">Select Service Rating</option>
<option value="5">Bad</option>
<option value="8">Average</option>
<option value="10">Good</option>
</select>
<input type="number" name="" id="no">
<button onclick="getdata()">Get</button>
<p id="demo"></p>
<script type="text/javascript">
function getdata(){
var bill = document.getElementById('bill').value;
var rating = document.getElementById('rating').value;
var no = document.getElementById('no').value;
var tip = (bill*(rating/100))*no;
document.getElementById('demo').innerHTML = tip;
}
</script>
Comments
Post a Comment