What is jQuery has id equivalent of the following statement?
$('#mydiv').hasClass('foo')
so you could give a class name and check that it contains a supplied id.
something like:
$('.mydiv').hasId('foo')
What is jQuery has id equivalent of the following statement?
$('#mydiv').hasClass('foo')
so you could give a class name and check that it contains a supplied id.
something like:
$('.mydiv').hasId('foo')
I would probably use $('.mydiv').is('#foo');
That said if you know the Id whay wouldnt you just apply it to the selector in the first place?
$('#' + theMysteryId + '.someClass').each(function() { /* do stuff */ });
If you only want to perform items to a class that has a particular ID, you could build that distinction into your selector:
$("#foo.bar"); // matches all id="foo" class="bar" elements.
$(".bar[id='foo']"); // matches all id="foo" class="bar" elements.