We have:
<html> <body> <div> <form> <ul> <li> <label>Simple text 1</label> <input type="text" name="inp1" value="Text 1"> </li> <li> <label>Simple text 2</label> <input type="text" name="inp2" value="Text 2"> </li> <li> <label>Simple text 3</label> <input type="text" name="inp3" value="Text 3"> </li> <ul> <input class="getInfoButton" type="button" value="Get Value"> </form> </div> </body> </html> Salt: We need to get the value of the third <input> , having such a selector $(".getInfoButton")
It is necessary to solve this problem optimally, tobish if I later want to move the third <input> to a few <li> below in the DOM tree (adding more points between the third and second <li> )
PS If this is impossible to solve, then as I understand you need to write your function
$('.getInfoButton').prev().children('input[type=text]').eq(3);- cyadvert<input>... in the DOM tree" - should I always refer to the third one or specifically, independently, what will it be like in the future? - lexxl