<html>
<head>
<script src="jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txtNumberA,#txtNumberB").keyup(function(){
if(isNaN($("#txtNumberA").val()))
{
alert('Please input Number A is number');
$("#txtNumberA").val('');
}
if(isNaN($("#txtNumberB").val()))
{
alert('Please input Number B is number');
$("#txtNumberB").val('');
}
$("#txtNumberC").val(parseFloat($("#txtNumberA").val())+parseFloat($("#txtNumberB").val()));
});
});
</script>
</head>
<body>
Number A <input type="text" id="txtNumberA" value=""> <br>
Number B <input type="text" id="txtNumberB" value=""> <br>
A + B = <input type="text" id="txtNumberC" value=""><br>
</body>
</html>
<html>
<head>
<script src="jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var sumTotal = 0;
$("#txtNumberA,#txtNumberB").keyup(function(){
if(isNaN($("#txtNumberA").val()))
{
alert('Please input Number A is number');
$("#txtNumberA").val('');
}
if(isNaN($("#txtNumberB").val()))
{
alert('Please input Number B is number');
$("#txtNumberB").val('');
}
sumTotal = parseFloat($("#txtNumberA").val())+parseFloat($("#txtNumberB").val());
});
});
</script>
</head>
<body>
Number A <input type="text" id="txtNumberA" value=""> <br>
Number B <input type="text" id="txtNumberB" value=""> <br>
A + B = <input type="text" id="txtNumberC" value=""><br>
</body>
</html>