I’m iterating through a series of elements in jQuery (intentionally).
So basically I want something like this, but with the correct syntax:
$(".sonicrow").each(function() {
$(this + 'somediv').css('background-color', 'red');
});
Obviously this is some kind of object/string mishmash. What would the correct syntax be for accessing the specific somediv within the this object?
Thanks,
John.
Where the second parameter is the “context” of the selector. Of cause your
somedivhave to be.somedivif it´s a class or#somedivif it´s an id.This question is related to How to get the children of the $(this) selector? which also contains this answer
According to jQuery context selector
$(selector, context)is implemented with$(context).find(selector).