Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

need to disable input for bootstrap timepicker

I am using Bootstrap time-picker. I have successfully implemented it. But what I need is user is only able to insert in 30 min gap like: 10:00,10:30,11:00 etc. For that I have tried is minuteStep as shown below, and it works perfect.

 $('#fantasyleague-draft_time').timepicker({
     template: false,
     showInputs: false,
     minuteStep: 30
 });

But what is the issue is user can type time as he need. So, how to prevent it to enter time manually?

For this I have refer bootstrap timepicker

like image 564
Ishan Shah Avatar asked Jan 01 '16 11:01

Ishan Shah


3 Answers

Try something like this in your text box :->

<input type="text" id="fantasyleague-draft_time" readonly="readonly">
like image 187
Tony Stark Avatar answered Oct 19 '22 00:10

Tony Stark


What i have done so far now is :

<input type="text" id="fantasyleague-draft_time" readonly>

Added CSS

fantasyleague-draft_time{cursor: pointer;}

and JS:

 $('#fantasyleague-draft_time').timepicker({
     template: false,
     showInputs: false,
     minuteStep: 30
 });
like image 37
Ishan Shah Avatar answered Oct 19 '22 01:10

Ishan Shah


Try <input type="text" disabled>..it will not allow to do anything..after 30 min remove disabled attribute using javascript or jquery

like image 1
Dhara Avatar answered Oct 19 '22 01:10

Dhara