WordPress.org

Ready to get started?Download WordPress

Forums

navigation bar parent elementselection (2 posts)

  1. yu0307
    Member
    Posted 1 year ago #

    I was wondering. if when i use
    wp_nav_menu( array( 'depth' => 3, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );

    we all come out the same html.

    if so, how could we use JQuery to select the li that is a parent??

    because after the html i can't seems to select the one.
    -----------------Output HTML----------------
    <ul id="main-nav" class="nav fl"><li id="menu-item-84" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-84 parent">User_home
    <ul class="sub-menu">
    <li id="menu-item-83" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-83">User_message
    <li id="menu-item-86" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-86 parent">My_Home
    <ul class="sub-menu">
    <li id="menu-item-88" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-88">[Photos]
    <li id="menu-item-89" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-89">[About]

    --------------------------------------------
    --------------Js----------------------------
    $(".parent").hover(
    function () {
    alert("parent!");
    },
    function () {

    }
    );
    --------------------------------------------

    this does not work~~~~~ HELP~~~~~~~~~~~~~~~~~~~~~

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you use jQuery's .parent() function?
    http://api.jquery.com/parent/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.