Click here to Skip to main content
15,917,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have taken table in which there are tableRows and tablerows have cells and cells have controls (textbox).[Table->TableRow->Cells->Textbox]

so how to find textbox...

For Example:==
var tb=dialog.childNodes[3];


(where dialog is DIV)
Posted
Comments
Prasad Khandekar 4-Jun-13 9:22am    
Consider using JQuery, It has really nice support for selectors and methods for navigating the hierarchy.

 
Share this answer
 
One of the solutions would be using jQuery, its method .children():
http://api.jquery.com/children/[^].

You can also use it with the method jQuery.each():
http://api.jquery.com/jQuery.each/[^].

For example:
JavaScript
someElement = $("#someId"); // or some other kind of selector
jQuery.each(someElement.children(), function() {
    child = this;
    // do something with each child
});


You can even do it recursively, to traverse all direct and indirect children of some type, CSS class or something like that.

See also: http://api.jquery.com/category/selectors/[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^],
http://learn.jquery.com/[^],
http://learn.jquery.com/using-jquery-core/[^],
http://learn.jquery.com/about-jquery/how-jquery-works/[^] (start from here).

—SA
 
Share this answer
 
v2
Comments
Prasad Khandekar 5-Jun-13 10:28am    
Really a nice answer! +5
Sergey Alexandrovich Kryukov 5-Jun-13 10:50am    
Thank you, Prasad.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900