Search code examples
jqueryasp.netformstraversaldescendant

jQuery finding deeply nested input element


I'm using a form control in my project listed here

When I include it in my page it generates a whole whack of dynamic html to format everything nicely. However, I am trying to apply jQuery datepicker to a few of the input elements inside the form and I have no idea how to select the inputs I want.

I've nested the SuperForm directly inside a div called "bookings" so I know that I can use that as a starting point but I need to go through all of the descendants of that div till I find the right inputs, I know in which order they appear so I assume I can use nth-child(x) in here somewhere but so far I haven't had any luck. Any help would be greatly appreciated!

SOLVED! Here is my solution:

$("#bookings :input[type='text']:eq(2)").datepicker({...});

Solution

  • SOLVED! Here is my solution:

    $("#bookings :input[type='text']:eq(2)").datepicker({...});