I am trying to traverse the DOM in a number of places, replacing some of the content.
jQuery('.homepage_buttons_text a[href^="http://danrobertsgroup.com/?attachment_id=1037"]').each(function(){
jQuery(this).html("<h1 class='homepage_button_title'>Workouts</h1><span class='homepage_button_title'>Books / DVD's / Downloads</span>");
});
this works fine when doing it in the console, but isn't working when I put it in the scripts file.
I am running a child-theme and enqueuing properly I think:
function child_theme_enqueue_scripts() {
wp_enqueue_script(
'child-scripts',
get_stylesheet_directory_uri() . '/js/child-scripts.js',
array( 'jquery' ),
'1.0',
true
);
}
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_scripts' );
It all loads fine. I have even called child-scripts.js in the footer and in very last place - but still no joy.
It's pretty annoying, any help appreciated.