0

I need to have a field in a form that allows me to enter hours and minutes. With bootstrap it is easy to use the bfh-timepicker class. However, the difficulty I am experiencing is to reset the field in such a way that the value entered disappears and the value indicated in the placeholder reappears.

<div class="bfh-timepicker" data-mode="24h" data-placeholder="Orario inizio" placeholder="Orario inizio" id="datepicker" data-time=""></div> 

<a onclick="resetta();" style="cursor: pointer;" id="resettaorarioinizio">Cancella</a>
function resetta() {
  $("#datepicker").val();   or //.val("");  
}

In this way the inserted time does not reset, but is updated according to the current time. I then tried to work on the data-time element:

$("#datepicker").data("time").val("");
// or    
$("#datepicker").attr("data-time").val("");    
// or    
$("#datepicker").setAttribute("data-time").val("");

The problem, however, also through data(), attr(), and setAttribute() is not solved. I would therefore need some suggestions to resolve this situation.

thank you very much to anyone who can help me

Babykey
  • 13
  • 4

0 Answers0