I have the JavaScript for inserting a timestamp upon a click. We are using the survey for an audit and need to have auditor click the time they start each task. I do not want to use time began survey, as I need multiple timing fields for different actions. The JavaScript I have when I copy it to a new question , once I test it, it populates into the one below, and it won't populate more than once.
I know there is something wrong with the code but I am not sure what.
Please paste the JS you are using here.
Create a text entry form field question with 1 field. In the click to write statement for field 1 paste the below code:
In the JS onReady function of the same question paste the below code:
var that =this;
jQuery("#"+that.questionId+" .InputText").attr("readonly",true);
jQuery("#"+that.questionId+" #button").on('click',function(){
jQuery("#"+that.questionId+" .InputText").val(new Date());
});
Hey! Thanks so much for posting this, it's almost exactly what I need. I'm wondering if there is a way to do this but instead of it recording it as a text/string variable, it gives the timestamp in military time? I want to export it out eventually and use math operations to subtract begin from end times to see how long something took that the respondent was observring. Any help is much appreciated.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.