IrfanRaza
IrfanRaza

Reputation: 3058

disable jquery datepicker

I have used jquery datepicker in my .aspx page. The control is working fine. What i need is to disable the control if the textbox on which it is linked is disabled. For ex. I am showing datepicker on textbox "txtDateOfAssignment". If the Enabled property of this textbox is false then datepicker should not be active on that.

Anybody have an idea?

Thanks in advance.

Upvotes: 0

Views: 2217

Answers (2)

Rajeeev
Rajeeev

Reputation: 1

Another possible Solution is

var j$=jQuery.noConflict();
j$("#inputTextID").datepicker(('disable' ));

j$("#inputTextID").datepicker(('enable' ));

Upvotes: 0

Mike
Mike

Reputation: 5193

if you look at the documentation you'll notice that there is a "disable" method, so you can do :

$('id-of-your-textbox').datepicker('disable');

Ok, finally you're not using jquery-UI but jquery-datepicker, so it should be more something like as referred to the documentation here

$(document).ready(function () {
  $('.date-picker').dpSetDisabled(true);
});

If you want to disable only 1 datepicker dont use the class selector ".date-picker" but the id of the datepicker you want to disable.

Upvotes: 2

Related Questions