TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed salah
NA
530
147.9k
How To Make Total For Every Column By Using Jquery
Jul 30 2016 5:53 PM
Name salary Bonus Deduction total
mickel 500 600 300 800
adil 600 600 600 600
total 1100 1200 900 1400
how to make total for every column meaning how to do total found last line for all column
total 1100 1200 900 1400
my code as following
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name=
"viewport"
content=
"width=device-width"
/>
<title>Index</title>
<script src=
"~/Scripts/jquery-1.10.2.js"
></script>
<script>
$(function () {
$(
"#btn"
).click(function () {
var x = $(
"#txt1"
).val();
var y = $(
"#txt2"
).val();
var z = $(
"#txt3"
).val();
var M = $(
"#txt4"
).val();
var L = parseInt(y) + parseInt(z) - parseInt(M);
$(
"#tb"
).append(
"<tr> <td>"
+ x +
"</td> <td>"
+ y +
"</td> <td>"
+ z +
"<td>"
+ M +
"</td><td>"
+ L +
"</td></tr>"
);
});
$(
"#tb"
).on(
"click"
,
"tr"
, function () {
$(
this
).find(
"td"
).slice(0, 4).prop(
"contenteditable"
,
true
);
});
});
</script>
</head>
<body>
<div>
Name<input type=
"text"
id=
"txt1"
/><br />
Salary<input type=
"text"
id=
"txt2"
/><br />
Bonus<input type=
"text"
id=
"txt3"
/><br />
Deduction<input type=
"text"
id=
"txt4"
/><br />
<input type=
"button"
value=
"add"
id=
"btn"
/>
<table>
<thead>
<tr>
<td>
Name
</td>
<td>
Salary
</td>
<td>
Bonus
</td>
<td>
Deduction
</td>
<td>
total
</td>
</tr>
</thead>
<tbody id=
"tb"
class
=
"tb1"
></tbody>
</table>
</div>
</body>
</html>
Reply
Answers (
1
)
Change Cell Content Salary Or Bonus change total same time
How to load data on drop down scroll load ?? (ASP.NET MVC)