Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: is there a way to make a recursive child selector?

instead of checking only the immediate children of an element, i would like to recursively check all children of the element.

specifically, something like

$("#survey11Form>input[type=text]:visible").val();

with the html:

<form id="survey11Form" name="survey11Form" action="#" method="post">
            <div id="survey11Div">

                <fieldset>
                    <legend>TEST'TEST"TEST</legend>


                        <div class="label">
                            <label test="" title="TEST'TEST" for="answer15">
                            TEST'TEST"TEST                      </label></div>


                        <div class="fieldWrapper text required">
                            <div style="width: 146px;" class="cellValue">
                                <input type="text" title="TEST'TEST" value="" id="survey11answer15" name="survey11answer15">

should give me the value of that input. the jquery i've come up with does not. any ideas as to what would work in this situation (and all recursive situations)?

thanks!

like image 591
gsquare567 Avatar asked Jun 09 '10 16:06

gsquare567


1 Answers

I think what you want is

$("#survey11Form input[type=text]:visible")
like image 161
John Hartsock Avatar answered Oct 20 '22 13:10

John Hartsock