Reputation: 165
I have a input box with ui calendar on it. I want to disable
the input
box so that the calendar doesn't open on user focus
of mouse to the input field.
I have used $('#enddate').attr('readonly', true);
to disable the input box, but still the calendar opens on clicking the input box.
The code snippet that I have used is as follows:
$('.starttime').click(function(){
atype=$('input:radio[name=startdate]:checked').val();
if(atype==2){
$('#enddate').attr('readonly', true);
}
else
$('#enddate').attr('readonly', false);
});
Upvotes: 1
Views: 627
Reputation: 34107
try this man: http://jsfiddle.net/4U7BS/ extra in this demo - http://jsfiddle.net/VjadE/ (from date will not open the calendar because its disabled
and to field will and I reckon thats what you want :)
I hope your DOM and rest Jquery is correct!
Hope it helps the cause!
code
$("#enddate").prop("disabled",true);
to enable
$("#enddate").prop("disabled",false);
Upvotes: 1