Skip to content

Instantly share code, notes, and snippets.

@annuman97
Created August 19, 2022 06:08
Show Gist options
  • Save annuman97/24e11a8b2bcea5572aecfa6531d76849 to your computer and use it in GitHub Desktop.
Save annuman97/24e11a8b2bcea5572aecfa6531d76849 to your computer and use it in GitHub Desktop.
var btnn = document.querySelector('.footable-filtering');
let btn = document.createElement("button");
btn.classList.add('mybtn');
btn.innerHTML = "DISPLAY TABLE BODY";
btnn.append(btn);
$('.footable tbody').hide();
document.querySelector('button.mybtn').addEventListener('click', function(){
$('.footable tbody').toggle();
const initialText = 'HIDE TABLE BODY';
if (btn.textContent.toLowerCase().includes(initialText.toLowerCase())) {
btn.textContent = 'DISPLAY TABLE BODY';
} else {
btn.textContent = initialText;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment