- Posts: 30
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var q1ID = '{QID}'; var q1 = $('#question'+q1ID); // Disable the "Next" button $('#ls-button-submit').prop('disabled', true); function getGPS() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showGPS, gpsError); } else { $('input.text', q1).val('No GPS Functionality'); $('input:hidden[id^="answer"]', q1).val('No GPS Functionality'); } } function gpsError(error) { alert('GPS Error: '+error.code+', '+error.message); } function showGPS(position) { $('input.text', q1).val(position.coords.latitude+', '+position.coords.longitude); $('input:hidden[id^="answer"]', q1).val(position.coords.latitude+';'+position.coords.longitude); // Enable the "Next" button $('#ls-button-submit').prop('disabled', false); } getGPS(); }); </script>