midstack
midstack

Reputation: 2123

How can I add class to the specific datepicker?

HTML

<input type="text" class="datepicker01">
<input type="text" class="datepicker02">

I have 2 input that opens the datepicker.I want to add class to the datepicker which opened in the second input (class="datepicker2"). How can I do this?

http://jsbin.com/cixubuto/1/edit

Upvotes: 1

Views: 4425

Answers (2)

HarryFink
HarryFink

Reputation: 1010

According to the docs you can set a beforeShow option:

$('.datepicker01').datepicker(
{
  beforeShow: function( input, inst){
    $(inst.dpDiv).addClass('aa');
  }
}
);

Upvotes: 5

Silz
Silz

Reputation: 256

Try the below , No need to bother about datepicker , considering it as normal jquery selector only, you can solve this issue :

 $('.datepicker01').datepicker();
 $('.datepicker02').datepicker();
 $('.datepicker02').addClass('ClassName');

Upvotes: -2

Related Questions