Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Created August 28, 2020 10:36
Show Gist options
  • Save reachkamrul/3e3aad2775829f3931211fabe3ca523c to your computer and use it in GitHub Desktop.
Save reachkamrul/3e3aad2775829f3931211fabe3ca523c to your computer and use it in GitHub Desktop.
var className = "my_btn";
var amazonText = "Check Price at Amazon";
var walmartText = "Check Price at Walmart";
var emptyText = "Item Unavailable";
function changeButtonText(){
var myClass = $table.find('tbody .'+className);
$table.find('tbody .'+className+ ' a').each(function(){
var myVal = $(this).attr('href');
if(myVal.match('amazon') || myVal.match('amzn')){
$(this).text(amazonText);
}
if(myVal.match('walmart')){
$(this).text(walmartText);
}
})
myClass.each(function(){
if ($(this).is(':empty')){
$(this).html(emptyText);
}
})
}
changeButtonText();
$table.on('after.ft.paging', function () {
changeButtonText();
});
$table.on("after.ft.filtering", function () {
changeButtonText();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment