Forums

How to ad a link class in wp_list_categories ? (6 posts)

  1. dolbysound
    Member
    Posted 3 years ago #

    Hi,
    I use jquery tooltip to ad buble info in my link, simply ad class="tooltip" in my href link.

    I would like ad a class in my category link (href ! not li)

    By défaut, i've :

    <ul id="nav">
          <li class="..."><a href="#">Logos</a></li>
      </ul>

    I would like :

    <ul id="nav">
          <li class="..."><a CLASS="TOOLTIP" href="#">Logos</a></li>
      </ul>

    How to do it ?

  2. stvwlf
    Member
    Posted 3 years ago #

    This should work

    <script type="text/javascript">
    jQuery(document).ready(function(){
    jQuery("ul#nav a").addClass("tooltip");
    });
    </script>

  3. stvwlf
    Member
    Posted 3 years ago #

    You have to load the jQuery library first, by the way...

    in header.php in your theme,
    put this
    <?php wp_enqueue_script('jquery'); ?>

    somewhere before this line
    <?php wp_head(); ?>

    Then put the script after the wp_head() line

    <script type="text/javascript">
    jQuery(document).ready(function(){
    jQuery("ul#nav a").addClass("tooltip");
    });
    </script>
  4. dolbysound
    Member
    Posted 3 years ago #

    Nice on Firefox but doesn't work on IE6-IE7 ?! Why ??

  5. stvwlf
    Member
    Posted 3 years ago #

    You'll have to check that with whoever made the jQuery tooltip routine

  6. dolbysound
    Member
    Posted 3 years ago #

    yes, jquery version is now update and all is ok ! Thx

Topic Closed

This topic has been closed to new replies.

About this Topic