test for condition m AND condition n using jquery
===

I am creating muti-level menu using jquery. When I click on a button in a given level I change the buttons colour and I display the next lower menu level for the button clicked.

For example, clicking "Polices" may show "New policy", "Renew policy", "Endorse policy" etc.

The "Policies" button is at level 1 and the others are at level 2. If I click another level 1 button I turn off (remove) the button colour class for all buttons except the button being clicked. For this button I toggle the button colour class (in case it's being clicked off or clicked a second time).

1) The problem comes when I click a level two button in that ALL the level one buttons' colour class are removed. So now I want to put type="level01" and type="level02" for the buttons in the different levels. (I call them buttons but they are actually anchor tags.)

This is my code to remove all but the current buttons' colour class:

    // remove the menuA-open class from all class menuA objects except the one being toggled
    $(".menuA[name!=" + $(this).text() +"]").removeClass("menuA-open");

Note that the text on the button (the anchor tag's innerHTML) is also in the name="" parameter.

Now I want to say something like:

    ($(".menuA[name!=" + $(this).text() +"]") and $("menu[type]!=$(this).[type])).removeClass("menuA-open");

but I'm failing find how to 'and' these two conditions correctly in jquery.

2) I use the text() function on $(this) in 

    $(".menuA[name!=" + $(this).text() +"]").removeClass("menuA-open");

because the anchor tag's innerHTML has a small graphic appended to the text. So this works fine for text lengths less than 19 characters but from there on the test fails??

Can anyone please help?

Chris