Mirage
Mirage

Reputation: 31548

Jquery datepicker not working on elements inside class given

If i use this then its working.

<td ><div> Timestamp: </div><input type="text" value="" class="datepicker"/></td>
$( ".datepicker" ).datepicker();

This above code is working but this is not working

<td  class="datepicker" ><div> Timestamp: </div><input type="text" value=""/></td>
    $( ".datepicker input" ).datepicker();

Upvotes: 0

Views: 1136

Answers (4)

Liber
Liber

Reputation: 850

Both ok.

Try to use web develop tools and step into the code to find out the errors.

Upvotes: 1

Andrey Santrosyan
Andrey Santrosyan

Reputation: 591

I think you need to use the child selector >

 $(".datepicker > input").datepicker();

Upvotes: 0

Doug
Doug

Reputation: 1028

Those are both correct. Do you have some malformed HTML elsewhere on the page? Is a JavaScript error being thrown before .datepicker() is called?

Upvotes: 2

TheVillageIdiot
TheVillageIdiot

Reputation: 40507

try using following selector:

$("td.datepicker input:text").datepicker();

Working example is here

Upvotes: 0

Related Questions