Uncaught TypeError: Cannot read property ‘replace’ of undefined
In WordPress jQuery is loaded in noConflict mode, it means that you need to use jQuery instead of the dollar sign $ You could wrap the code in an anonymous function (technically any IIFE) where you pass in jQuery to be mapped to $ and combine this with document ready, like this: jQuery(document).ready(function($) { // … Read more