- Enabling SMS Feature for China Unicom VN007+ 5G Modem
- Generating Running Balance or Statement of Acount in SQL
- Model Binded Custom HTML Helper for C# MVC
- Easyworship 2009 fix for Windows 10 Nov. 2015 Update
- Simple way of encrypting and decrypting sensitive data using phrase
- HTML Color Chart
- Getting The Last Column Of The Last Row Of A Table with jQuery
- Microsoft SQL Server Transactional and Merge Replication step by step
- Check for duplicates before inserting a record
- Creating Stored Procedure with Output Variable
Let's make it straight. You need to highlight the grand total of a report table. There are lot of approaches on how we can achive this. Let's assume that you already referenced jQuery in your HTML. First of all, we need to identify the table. Let's name it grandTotalObj
var grandTotalObj = $('#tblYTPLResult');
Then we need to get the last Table Row (tr), but first, we need to get the list of rows
var grandTotalObj = $('#tblYTPLResult')
.find('tr');
Now that we have the list, let's get the last one
var grandTotalObj = $('#tblYTPLResult')
.find('tr').last();
Same thing with the rows, we also need to get the list of Table Data (td) of the last row
var grandTotalObj = $('#tblYTPLResult')
.find('tr').last()
.find('td');
And finally, we may now get the last column
var grandTotalObj = $('#tblYTPLResult')
.find('tr').last()
.find('td').last();
Now that we got what we need, we need add the Grand Total text and highlight it
var grandTotalObj = $('#tblYTPLResult')
.find('tr').last()
.find('td').last();
grandTotalObj.prepend('Grand Total<br />');
grandTotalObj.wrapInner('<b></b>');
A working demo of this snippet can be found on my Youtube Playlist Calculator. We may always change this snippet according to our needs. Hope it helps.
Back To Programming & Software Support