Note that there are some explanatory texts on larger screens.

plurals
  1. POtest for condition m AND condition n using jquery
    primarykey
    data
    text
    <p>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.</p> <p>For example, clicking "Polices" may show "New policy", "Renew policy", "Endorse policy" etc.</p> <p>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).</p> <p>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.)</p> <p>This is my code to remove all but the current buttons' colour class:</p> <pre><code>// remove the menuA-open class from all class menuA objects except the one being toggled $(".menuA[name!=" + $(this).text() +"]").removeClass("menuA-open"); </code></pre> <p>Note that the text on the button (the anchor tag's innerHTML) is also in the name="" parameter.</p> <p>Now I want to say something like:</p> <pre><code>($(".menuA[name!=" + $(this).text() +"]") and $("menu[type]==$(this)[type])).removeClass("menuA-open"); </code></pre> <p>but I'm failing find how to 'and' these two conditions correctly in jquery.</p> <p>2) I use the text() function on $(this) in </p> <pre><code>$(".menuA[name!=" + $(this).text() +"]").removeClass("menuA-open"); </code></pre> <p>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??</p> <p>Can anyone please help?</p> <p>Chris</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload