Reputation: 2306
I'm very new to javascript and I need some help editing the content of a table cell.
For example, I would like to change the value of the matches won, drawn and lost to the percentage value in this page.
I'm not asking for the written code (but if you want, that isn't going to make me unhappy) but just for a link of a page explaining how to do it.
Thanks :)
Upvotes: 0
Views: 637
Reputation: 171700
If you look up how to insert jQuery with greasemonkey can use the following which is tested on the page using a browser console:
$(function(){
function percent_of_GP( gp, val){
return parseInt( (100*val)/gp,10)
}
$('.teamStandings tbody tr').each(function(){
var $cells=$(this).find('td')
var gp=parseInt($cells.eq(4).text(),10) ;
$cells.slice(5,14).each(function(){
$(this).html(function(i, html){
return percent_of_GP( gp,html)+'%'
})
});
});
});
Changes all Won/Lost/Drawn to percent in all 3 columns
Upvotes: 1