- Posts: 4
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var q1ID = '{QID}'; var q1 = $('#question'+q1ID); function getGPS() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showGPS, gpsError); } else { $('input.text', 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); } getGPS(); }); </script><script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var q1ID = '{QID}'; var q1 = $('#question'+q1ID); 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); } getGPS(); }); </script><script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var q1ID = '{QID}'; var q1 = $('#question'+q1ID); // Click event for the button $('.gpsLink').click(function(){ getGPS(); }); 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); } }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.