Hi, Please help... How can I code at Jquery, "Selecting a div's links but not child divs' links of that div? Thanks. Best Regards.
use the direct child selector >
e.g
$('div>a')
UPDATE: to appease Mr RoBorg
If you do have anchors inside nested elements inside the first div then the following will work. This uses a filter to ensure that the parent div is indeed the div you are targetting rather than a nested div.
var firstDivAnchors = $('div a').filter( function(){
return $(this).closest('div').is('#yourDiv');
});
If there is a specific div you want to target, you can try:
$("div#mydiv a :not(div a)");
EDIT: It would be great if you post some more context (HTML) :)
I don't remember quite well, but doesn't children() does this work?
$(thisDiv).children('a')
In docs.jquery.com it reads: children() Get a set of elements containing all of the unique immediate children of each of the matched set of elements.
[It's solved] Thanks too much to everybody... Especially to Redsquare... You solved my problem. Best regards to everybody.