Skip to content

Instantly share code, notes, and snippets.

@annuman97
Created August 9, 2022 11:45
Show Gist options
  • Select an option

  • Save annuman97/500dd67f3c2fea0d0c3d66afc5f8f122 to your computer and use it in GitHub Desktop.

Select an option

Save annuman97/500dd67f3c2fea0d0c3d66afc5f8f122 to your computer and use it in GitHub Desktop.
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
var btnn = document.querySelector('.footable_parent');
let btn = document.createElement("button");
btn.classList.add('mybtn');
btn.innerHTML = "DISPLAY FILTERS";
btnn.prepend(btn);
$('tr.footable-filtering').hide();
document.querySelector('button.mybtn').addEventListener('click', function(){
$('tr.footable-filtering').toggle();
const initialText = 'HIDE FILTERS';
if (btn.textContent.toLowerCase().includes(initialText.toLowerCase())) {
btn.textContent = 'DISPLAY FILTERS';
} else {
btn.textContent = initialText;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment