Change Text in Page Tab Panel

scan page for text if match regex then replace

by Adam Kinnucane

HTML

<a href="https://www.w3schools.com">
  Newer
</a>
<a href="https://www.w3schools.com">
  Older
</a>
<a href="https://www.w3schools.com">
  Nutrition Info
</a>

JavaScript

$(document).ready(function() {
  $("a").each(function(idx, el) {
    var w = $(el).text();
    if (w.match(/^\W*Newer\W*$/)) {
      $(el).text(' Next ');
    } else if (w.match(/^\W*Older\W*$/)) {
      $(el).text(' Previous ');
    }

  });
});