• Hi, I want to use my own simple JavaScript where when user clicks a menu item, it changes background-color, but since I’m pulling my list from WP db, how the heck do I add something like:

    <div id=”menu_item_1″ onclick=”changeBgColor(“menu_item_1″)”>…</div> and I want to add this for each menu item but I have this in my header.php:

    <div class=”menuItems”>
    <?php wp_list_pages(‘title_li=&sort_column=menu_order’); ?>
    </div><!– END menuItems–>

    I’m using wp_list_pages rather than hardcode my menu items, so how do I do this? Please anyone, thanks!

Viewing 1 replies (of 1 total)
  • jevets

    (@jevets)

    Use an external javascript file rather than embedding javascript into the HTML.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding my own simple JavaScript in menu nav’ is closed to new replies.