I'm using a starter theme that was provided to me by a friend, and have successfully implemented jQuery several times on the website. I want a background image inside a div to change when the user click a li in the menu.
<ul class="mainNav">
<?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'primary' ) ); ?>
</ul>
$(function(){
$('.menu-item-23').click(function(){
$('#changeMe').css('background-image','url("../wp-content/themes/theme-name/i/logo4.png")');
});
I am able to make this work if I replace .menu-item-23 with other elements on the page - so I know it isn't a file path issue, and I don't think it's the jQuery code. It seems like I'm not selecting the list item properly, but I have tried dozens of different selectors, (li#menu-item-23, li.menu-item-23, ul.mainNav li#menu-item-23 etc etc)