- Posts: 5
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
$(document).on('ready pjax:complete',function() { // Get question var q2ID = '{QID}'; var q2 = $('#question'+q2ID); function getGPS() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showGPS, showError, { enableHighAccuracy: false, maximumAge: 0, timeout: 30000 } ); //alert("Geolocation is not enabled"); } else { //alert("Geolocation is enabled"); $('input.text', q2).val('Geolocation is not enabled'); } } function showError(error) { //alert('GPS Error: '+error.code+', '+error.message); { switch (error.code) { case error.TIMEOUT: //alert("The request to get user location has aborted as it has taken too long"); $('input.text', q2).val('Request timeout'); break; case error.POSITION_UNAVAILABLE: //alert("Location information is not available"); $('input.text', q2).val('No location information'); break; case error.PERMISSION_DENIED: //alert("Permission to share location information has been denied"); $('input.text', q2).val('Permission denied by user'); break; default: //alert("An unknown error occurred."); $('input.text', q2).val('Unknown error'); } } } function showGPS(position) { $('input.text', q2).val(position.coords.latitude+', '+position.coords.longitude); } getGPS(); } ); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#answer929736X13X17').val('{INSERTANS:929736X12X18}'); }); </script>
$('input.text', q2).val(position.coords.latitude+', '+position.coords.longitude);
$('#answer929736X12X24').val(position.coords.latitude+', '+position.coords.longitude);