Fix localized variable usage to put behind an if() undefined check; Cleanup JS formatting; Fix duplicate $( 'element' ) usage; Switch to jQuery( function( $ ) { instead of jQuery(document).ready(; Fix .attr( 'data-xxxx' ) usage to use .data( 'xxxx' ) instead; Switch out .attr() for .prop()