views:

218

answers:

4

In my div i have a child div of class "someClass". I want to access that child by classname, not id.

EDIT: Only in this particular div, not all the other divs with same classname

+1  A: 
var div = $('.someClass');

See jQuery Selectors.

musicfreak
+1  A: 

just use the class selector:

$('div>.someClass').toggle()
Marwan Aouida
+4  A: 
var childOfNamedDiv = $('#namedDiv>.someClass')
Chris Farmer
+1  A: 

if you already have a reference to the jquery object that is the parent of the div that you want to find:

var parent = $("#someDiv"); // this is the div that you may alread have found earlier
var child = parent.children(".someClass");
Darko Z