Jquery – Use of function – Passing values through function

Here we study about the jquery function. By using function we can use same code for multiple times. Here I have created the Add function which I can use for no. of times.
The code is as follows

<!DOCTYPE html>
<html>
<head>
<title>Passing Value Through Function</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
</head>
<body>
<input type="text" id="textboxone">+
<input type="text" id="textboxtwo">=<span style="padding:0 10px;"></span>
<button id="addbutton">Add</button>
<script>
$("#addbutton").click(function(){

	var a=$("#textboxone").val();
	var b=$("#textboxtwo").val();
	var d=addnumbers(a,b);
	$("span").append(d)
});
function addnumbers(a,b)
{
	var c=Number(a)+Number(b);
	return c;
}
</script>
</body>
</html>

Searched Tags- for this post :
0nikhil, nikhil ughade, Jquery, addition of numbers using jquery, jquery function

Hope it will help you.

Thanks,
Nikhil Ughade
(WEB DeSigNer)
Pune,IN

Nikhil on Deviant Art
http://designikx.deviantart.com
Art – community of artists and those devoted to art. Digital art, skin art, themes, wallpaper art, traditional art, photography, poetry / prose. Art prints.

Nikhil on Twitter
https://twitter.com/0nikhil
—— Advertise Starts ——

—— Advertise Ends ——

Advertisements

About Nikhil
Name : Nikhil Ughade UI Developer, Accidentally in design field, no turn back since then. Location : Pune (MH, INDIA) From : Amravati (MH,INDIA) College : VYWS's College Of Engg. Badnera, Amravati Hobby : Social Networking, Designing Web Sites, Photography, Reading Books. In Free time works for NGO.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: