Changing 2nd Table Caption Text

Hi Jon (or others who can assist),

Our Squib fleet wants to use both scratch and handicapped results, all good so far. They also want to show the scratch summary table first, ok. I also need to change the table caption Rating system ‘NHC4’ to ‘EHS’. This JS code works for the first summary table, but I need it to operate on the second, handicap, summary table.

var sOrig = ‘NHC4’;
var sReplace = ‘EHS’;
var sSelector = ‘.caption.summarycaption’;

$(document).ready(function () {

// Only operate on the first matching caption (i.e. first summary table)
var $firstCaption = $(sSelector).first();
$firstCaption.text($firstCaption.text().replace(sOrig, sReplace));

});

I’ve tried simply changing ‘.first’ to ‘.second’ but that didn’t work.

Do you have any solution that will change the specified text on the second table caption? Or even on any summary table caption where the specified text is found.

Many thanks.

Regards, Jools.

Hi Julian,

Try this

//
// name=ModCaptionSecond
// dependencies=jQuery
// description=Modify summary tables captions.
// author=Jon Eskdale
// date=2026-5-3
// version=1.0
// url=http://sailwave.com
// email=jon@sailwave.com
// twitter=@eskdale
//

var sOrig = ‘IRC’;
var sReplace = ‘EHS’;
var sSelector = ‘.caption.summarycaption’;

$(document).ready(function () {
// Only operate on the second matching caption (i.e. second summary table)
var $secondCaption = $(sSelector).eq(1);
$secondCaption.text($secondCaption.text().replace(sOrig, sReplace));
});

Regards

Jon