-1

I found this post about setting up a query to show/hide elements on a page: Show / Hide elements based on query string value

How do I extend it to show/hide multiple elements?

For instance... Let's say I have six elements on a page with the following classes: .a, .b, .c, .d, .e, .f

With one query I hide: .b,.d,.f and another hide: .a, .c, .e

Two different queries that can handle hiding multiple elements.

Can anyone help out?

1
  • Elements can have several classes, separated by spaces in the HTML. What you might do is add a new class to the elements you want to show or hide. Commented Feb 25, 2013 at 17:20

1 Answer 1

1

$('.b,.d,.f').hide();

$('.a, .c, .e').hide();

Sign up to request clarification or add additional context in comments.

7 Comments

Perhaps my question wan't completely understood... Using the same model illustrated on the link above, how do I hide multiple elements to that specific query?
@JosephSjoblom That's why it's always a good idea to post the code you've tried.
Yeah but that was a question by someone else, it wasn't clear that you were using the exact same code...would have been good to post it in your actual question. Anyway, would $("div.show_on_success").toggle(document.URL.indexOf("success=true") !== -1); $("div.show_on_something_else").toggle(document.URL.indexOf("something_else=true") !== -1); be any closer to what you're trying to achieve?
Or maybe you're looking for $("div.show_on_success, div.also_show_on_success").toggle(document.URL.indexOf("success=true") != -1);
sorry, I probably should have posted code... I'll update my post above.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.