SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Selecting problems & else if - Glasspoole wants to be a Ninja - Part1

    Hi,

    the jQuery Ninja book is great, but i have some problems. I hope i get help here at getting my problems solved. So i start one thread for every problem, cause for me getting the problems solved here with hepl is the best way to lern it.

    The hardest part for me is allways to get the right elements.

    Ok, i have a form and in this form i have a lable (id="hint").
    After sending the form above the form a div shows up.
    If everything is ok the div looks like that:

    <div id="results"><p></p></div>
    if theres an error

    Code:
    <div id="results"><p class="error"></p></div>
    I want to hide the <lable id="hint"> and the form if there is <div id="results"><p>
    If there is <div id="results"><p class="error"> i just want to hide the <lable id="hint">

    This works if theres an error and hides the hint

    Code:
    if ($("div#results p.error").length) {
      $('#hint').hide();
    }
    But how to check for #results without p class="error"?

    Code:
    if ($("div#results p.error").length) {
      $('#hint').hide();
    } else if {
    $("div#results but p not class error").length) {
      $('#hint, form').hide();
    }

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No edit button here?

    Ok, same probleme here.

    Code:
    $(document).ready(function() {
     $('nav#menu a')
      .hover(function() {
       $(this).stop().animate({ left: 5 }, 'fast');
      }, function() {
       $(this).stop().animate({ left: 0 }, 'fast');
      });
    });
    but how to exclude the "a" that is in a "li" with class active?

    Edit:
    oh the edit button has a time limit.

    Ok, i got this one:
    Code:
    $('nav#menu ul li a:not(ul li.active a)')


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •