Copy the input value to a div with jQuery -


i'd implement functionality, if user clicks on date datetime-picker window, value gets copied into div class.

here html code sample:

<input      type="text"      class="start_time"      id="time2" name="beginn"      placeholder="00:00"      style="width: 35px" >        <div class="start_time_paste">     paste here value datetime input!! </div> 

here jquery code:

jquery('#time2').datetimepicker({     datepicker:false,     format:'h:i',     step: '30' });  jquery('#time2').on('change', function() {     if(jquery(this).val() === '0') {          console.log("läuft");         var new_start_time = jquery('.start_time').val();         jquery('.start_time_paste').html(new_start_time);      }     }); 

here jsfiddle example: http://jsfiddle.net/c374e/

i don't know i'm doing wrong :/

hope can me.

try use onselecttime event of datetimepicker. plugin stopping execution of change event.

       jquery('#time2').datetimepicker        ({               datepicker:false,               format:'h:i',               step: '30',               onselecttime: function(ch)               {                      var new_start_time = jquery('.start_time').val();                      jquery('.start_time_paste').html(new_start_time);               }           }); 

here demo.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -