Selecting an element based on class and id in jquery - similar to an SQL query
- by Ankur
I want to select an element based on it's class and id, I have seen many similar questions on SO. Most of the users ask why would you ever want to do this - which is not very helpful, trust me, this is the simplest way of solving my UI problem, and it's a very unique and intereting UI related to making generic triple stores easily browsable.
At the moment the jQUery looks like this:
$(document).ready( function() {
$(".predicates").hide();
$(".objects").hide();
$("#subject").click(
function() {
$("#predId, .predicates").toggle(); // this line
}
);
$("#predId").click(
function() {
$("#objId, .objects").toggle();
}
);
});
The line I am really interested in is this
$("#predId, .predicates").toggle();
how do I get the select to ensure that both #predId and .predicates are true, at the moment it seems that only one or the other has to be true. Is there something like an && operator?