Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rafaehlers/ca73a92f7f3e91bf8a506faecf108db6 to your computer and use it in GitHub Desktop.
Save rafaehlers/ca73a92f7f3e91bf8a506faecf108db6 to your computer and use it in GitHub Desktop.
Turns the search label into a placeholder for DataTable's Search field
<?php wp_footer(); ?><!-- DON'T COPY THIS LINE, IT'S JUST HERE SO YOU KNOW WHERE TO PLACE THE <SCRIPT> BELOW -->
<script type="text/javascript">
(function($){
$(document).ready(function(){
$("#DataTables_Table_0_filter :input").attr("placeholder", 'Search');
var divhtml = $("#DataTables_Table_0_filter label").html();
$("#DataTables_Table_0_filter label").html(divhtml.replace("Search:", " "));
});
})(window.jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment