ltrem Posted November 27, 2009 Share Posted November 27, 2009 Hey guys, <td id=”test”> <div>blabla</div> <div class=”ulError” style=”margin: 0px 0px 0px 0px;”></div> </td> I want to access to the second div in jQuery... but I also want to access it from the TD #test. I tried different thing like : $(’#test:eq(1)’).......... didn’t worked. $(’#test > .ulError’)........ didn’t worked. I need to get to the .ulError by the #test because I have a #test2 that is exactly the same... so I can't just call the .ulError straight... Would this work? $('#test').children('div .ulError') Thanks for your time! Link to comment https://forums.phpfreaks.com/topic/183129-get-an-element-with-his-class-by-calling-his-parent-first-jquery-help/ Share on other sites More sharing options...
JustLikeIcarus Posted November 27, 2009 Share Posted November 27, 2009 You could do $('#test .ulError'). or $('#test').find('.ulError') Both should return the element you want. Link to comment https://forums.phpfreaks.com/topic/183129-get-an-element-with-his-class-by-calling-his-parent-first-jquery-help/#findComment-966512 Share on other sites More sharing options...
ltrem Posted November 27, 2009 Author Share Posted November 27, 2009 $('#test .ulError'). This worked fine! Thanks... can't believe I didn't try it before asking here.. lol thanks mate! Link to comment https://forums.phpfreaks.com/topic/183129-get-an-element-with-his-class-by-calling-his-parent-first-jquery-help/#findComment-966534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.