I am trying to select all elements on the page which have the string 'aggr' as part of their id value. Then I am trying to replace the text 'Sum 'in these elements to 'Total'.
My JQuery is below but doesn't seem to be working....
$('TBODY[id*=aggr]').each(function(i){
var aggrHTML = $('TBODY[id*=aggr]');
var aggrText = aggrHTML.text();
var newText = aggrText.replace("Sum","Total Holiday Leave")
aggrHTML.html(newText);
});
Try something like this
I think that will work.
Basically you it iterates over a set of objects, but you have to use $(this) to get the current object.
I left it the way you had it so you can understand it more.
Try this: