Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Cordova应用程序未在span标记中持久化数据_Javascript_Jquery_Cordova - Fatal编程技术网

Javascript Cordova应用程序未在span标记中持久化数据

Javascript Cordova应用程序未在span标记中持久化数据,javascript,jquery,cordova,Javascript,Jquery,Cordova,正在开发我的第一个Cordova应用程序。当我单击一个应该填充量程的按钮时,我看到值填充在量程中,但随后闪烁,量程为空。当我再次点击按钮时,什么也没发生。如果我单击home按钮,我可以单击该按钮并看到值,但它们再次消失。我不明白为什么它们会被删除。我正在使用.NETIDE开发RippleNexus并进行测试。Chrome开发工具中没有错误 (函数(){ “严格使用”; document.addEventListener('devicerady',ondevicerady.bind(this),

正在开发我的第一个Cordova应用程序。当我单击一个应该填充量程的按钮时,我看到值填充在量程中,但随后闪烁,量程为空。当我再次点击按钮时,什么也没发生。如果我单击home按钮,我可以单击该按钮并看到值,但它们再次消失。我不明白为什么它们会被删除。我正在使用.NETIDE开发RippleNexus并进行测试。Chrome开发工具中没有错误

(函数(){
“严格使用”;
document.addEventListener('devicerady',ondevicerady.bind(this),false);
函数getPosition(){
变量选项={
EnableHighAccurance:正确,
最高限额:3600000
}
var watchID=navigator.geolocation.getCurrentPosition(onSuccess、onError、options);
函数onSuccess(位置){
$('#latitude').text(position.coords.latitude);
$('#longitude').text(position.coords.longitude);
$('#althip').text(position.coords.althip);
$(“#精度”).text(position.coords.accurity);
$('altitudeAccuracy').text(position.coords.altitudeAccuracy);
$('#heading').text(position.coords.heading);
$('#speed').text(position.coords.speed);
$('#timestamp').text(position.timestamp);
};
函数onError(错误){
警报('code:'+error.code+'\n'+'消息:'+error.message+'\n');
}
}
函数watchPosition(){
变量选项={
最大值:3600000,
超时:3000,
EnableHighAccurance:正确,
}
var watchID=navigator.geolocation.watchPosition(onSuccess、onError、options);
函数onSuccess(位置){
$('#Latitude').text(position.coords.Latitude);
$('#longitude').text(position.coords.longitude);
$('#althip').text(position.coords.althip);
$(“#精度”).text(position.coords.accurity);
$('altitudeAccuracy').text(position.coords.altitudeAccuracy);
$('#heading').text(position.coords.heading);
$('#speed').text(position.coords.speed);
$('#timestamp').text(position.timestamp);
};
函数onError(错误){
警报('code:'+error.code+'\n'+'消息:'+error.message+'\n');
}
}
函数ondevicerady(){
document.getElementById(“getPosition”).addEventListener(“单击”,getPosition);
document.getElementById(“watchPosition”).addEventListener(“单击”,watchPosition);
};
} )();
表单{
边框底部:1px实心#ddd;
垫底:5px;
}
#头衔{
字体大小:16px;
}
#总结{
字体大小:35px;
}
#img概要{
浮动:对;
}
#错误消息{
文本对齐:居中;
利润率最高:50%;
字体大小:粗体;
}

全球定位系统
我的酷GPS
当前位置
监视位置
  • 纬度:
  • 经度:
  • 海拔高度:
  • 准确度:
  • 标题:
  • 速度:
  • 时间戳:
我的酷GPS
检查代码中的警报,它们可能导致您所指的问题。其次,表单标记中的按钮将在单击时尝试提交该表单,而不使用preventDefault()语句。因为它看起来不像是在使用表单做任何事情,所以您可以将该html元素全部丢弃。

更新:如果我注释掉:它不会清除值。我肯定我做错了什么,但不知道是什么。对于当前版本的jquerymobile1.4.5,我应该将其与jquery2.1.0配对,我的理解正确吗?