- Posts: 10269
- Thank you received: 3648
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify some elements var thisQuestion = $('#question{QID}'); var surveyRoot = location.pathname.split('index.php')[0]; // Define the timepicker function insertPickers() { $('tr.subquestion-list', thisQuestion).each(function(i) { var startDateTextBox = $('input[type="text"]:eq(0)', this); var endDateTextBox = $('input[type="text"]:eq(1)', this); $.timepicker.datetimeRange( startDateTextBox, endDateTextBox, { minInterval: (1000*60*60), // 1hr dateFormat: 'dd M yy', timeFormat: 'HH:mm', start: { }, // start picker options end: { } // end picker options } ); }); } // Insert the timepickers if (!$.isFunction($.fn.timepicker)) { $('head link[rel="stylesheet"]').last().after('<link rel="stylesheet" href="'+surveyRoot+'third_party/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.css" type="text/css" media="screen">'); $.getScript( surveyRoot+'third_party/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js', function( data, textStatus, jqxhr ) { insertPickers(); }); } else { insertPickers(); } }); </script>