我试图禁用我的 jquery 移动应用程序上的提交按钮。我已经尝试了好几天才能让它工作。这些按钮不会启用或禁用。这是我尝试输入的众多脚本之一
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
checkConnection();
}
function checkConnection() {
var networkState = navigator.network.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
if(networkState==Connection.UNKNOWN || networkState==Connection.NONE) {
$('[type="submit"]').button('disable');
$('[type="submit"]').button('refresh');
} else {
$('[type="submit"]').button('enable');
$('[type="submit"]').button('refresh');
}
`