Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An advanced selector request $.level() #28

Closed
BerkerYuceer opened this issue Mar 27, 2013 · 1 comment
Closed

An advanced selector request $.level() #28

BerkerYuceer opened this issue Mar 27, 2013 · 1 comment

Comments

@BerkerYuceer
Copy link

I was thinking on a tool that would make people's life easier by making a recursive search of elements and give us the deepest level when plainly used.

Level 0
<div id="test">
    Level 1
    <div>
        Level 2
        <div class="third">
            Level 3
            <div>
                Level 4
            </div>
        </div>
    </div>
</div>

It should return level count when no index is given;

$("#test").level(); // Which should return 4

also this should select dom at given level index such as;

$(document).ready(function() {
    var obj = $("#test").level(2);
    alert(obj); // Which should return obj
    alert(obj.attr('class')); // Which should return "third"
});

and when there are more than 1 element at that level should return obj array;

Level 0
<div id="test">
    Level 1
    <div>
        Level 2
        <div class="third">
            Level 3
            <div>
                Level 4
            </div>
        </div>
        <div></div>
        <a></a>
        <img />
        <span> </span>
    </div>
</div>

$(document).ready(function() {
    var obj = $("#test").level(2);
    alert(obj); // Which should return obj array
    alert(obj.length); // Which should return 4 (starting by zero)
});

this would help a lot and solve many turnarounds done with parent(), children(), find() etc..
If its posible to add this feature please contact me (berkeryuceer@yahoo.com).

@rdworth
Copy link
Contributor

rdworth commented Mar 27, 2013

This issue queue is for bugs found in pages on the jquery.com website. Your suggestion is more suited to http://forum.jquery.com/

@rdworth rdworth closed this as completed Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants