Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6749161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:39:24+00:00 2026-05-26T12:39:24+00:00

I see the method of getting second class name with jquery but how do

  • 0

I see the method of getting second class name with jquery but how do I do it in mootools , my element is <li class="parent active">

I need to match full class name like li.parent.active and adjust height if that class is present I tried
$$('li').hasClass('parent active') or getProperty but all of them return true even if active is not present, if I add .parent.active I get

The expression is not a legal expression. now I must support mootols 1.1 ,1.2 ,1.3 working on CMS here so I started with the ugly one 1.1 version

this is how is actually needed

var holderdiv =$('mymenu');
if($$('li.parent.active')){holderdiv.setStyle({'height':'50px'});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:39:25+00:00Added an answer on May 26, 2026 at 12:39 pm

    if($$('li.parent.active') == true) returns true as in, it’s truthy (defined, not null).

    if you mean to say: is there at least one child element that has .parent and .active, you can do:

    if (holderdiv.getElement("li.parent.active")) // at least one.
        holderDiv.setStyle("height", 50); // setStyle uses a value pair, not an object.
    

    if they are not children of holderdiv just do document.getElement or whateverElObj.getElement instead.

    this will likely break in 1.11 due to old xpath stuff.

    one way to do it so it works in all versions would be this (though you should only do this if MooTools.version is wrong due to performance cost of double loops):

    var holderdiv = $("holderdiv");
    
    if (holderdiv.getElements("li.parent").some(function(el){ return el.hasClass("active"); })) {
        // at least one.
        holderdiv.setStyle("height", 50);
    }
    

    the .some will run through all li.parent until it finds one that matches the condition (hasClass("active")) and then return boolean true else, false.

    http://jsfiddle.net/dimitar/BqwAk/

    if you need to keep a reference of the lis into a collection, use .filter instead:

    var lis = holderdiv.getElements("li.parent").filter(function(el){ 
        return el.hasClass("active"); 
    });
    

    if all have .parent and only one can be active, you don’t really care so you can just do

    if (holderdiv.getElement("li.active"))
    

    or

    if (holderdiv.getElement("li.active").hasClass("parent"))
    

    … to double check if they don’t all have .parent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see that you can enable/disable using the EnableWindow method, but how do I
How do I implement this method (see below)? I'm new to Objective-C and I'm
Please look at the code at the end to see the method I've been
I can't find the documentation for the NSString sizeWithFont:forWidth:lineBreakMode: method (see Kevin Ballard 's
See the four lines in the Go() method below: delegate void Action<T>(T arg); delegate
I often see two conflicting strategies for method interfaces, loosely summarized as follows: //
Looking to see if there's an existing method or application to increase display size
Is it possible to see the return value of a method after the line
What tool or method can I use to see what code something like an
This simple Python method I put together just checks to see if Tomcat is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.