filmov
tv
Class-2 | Best Jquery Tutorial | Adding Two Numbers in Jquery | Jquery Full Course | Jquery advanced

Показать описание
<!-- Note: just find and Replace < with Lesser than sign and > with Greater than Sign -->
<html>
<head>
<title>Jquery</title>
<script>
$
(
function()
{
$('.ad').click(function(){
var a=parseInt($('.n1').val());
var b=parseInt($('.n2').val());
var c=a+b;
alert("The Sum is = " + c);
})
}
)
</script>
</head>
<body>
Enter Number 1<input type="text" class="n1"/><br/>
Enter Number 2<input type="text" class="n2"/><br/>
<input type="button" class="ad" value="Add">
</body>
</html>
<html>
<head>
<title>Jquery</title>
<script>
$
(
function()
{
$('.ad').click(function(){
var a=parseInt($('.n1').val());
var b=parseInt($('.n2').val());
var c=a+b;
alert("The Sum is = " + c);
})
}
)
</script>
</head>
<body>
Enter Number 1<input type="text" class="n1"/><br/>
Enter Number 2<input type="text" class="n2"/><br/>
<input type="button" class="ad" value="Add">
</body>
</html>