Jquery function working in Dev Console but not otherwise [duplicate]
As toscho pointed out, use jQuery(document).ready(function($) { … }); instead of $( function() { … }); Edit: Main problem is WP rich text editor escaping your html <script> tags. See https://codex.wordpress.org/Using_Javascript at the bottom of the page for a plugin-based workaround to turn off formating for specific posts/pages, allowing you to insert code. Alternately, add … Read more