TL; DR
>问题1:带有click / tap / vclick / touchstart的按钮,在我的cordova应用程序中仅部分(10-30%的时间)工作(仅限AndroID).
>问题2:表单中的按钮(提交按钮)不会触发我的.submit(function(){..});事件,但键盘上的“进入/输入”按钮确实触发了事件. (也仅限AndroID)
我正在尝试为ios / androID / windows开发混合应用程序.在应用程序中,我偶尔会有触发某些 *** 作的按钮.
问题1
通常我会使用.on(‘click’,function(){…});但我知道点击并不真正与移动设备配合.相反,我会使用vclick,tap或touchstart,但这似乎并不总是有效.有时按钮会触发,有时它会在我反复点击/点击后触发.
问题2
在其他页面上,我将有一个包含在< form>中的表单.标记并包含< button type =“submit”ID =“btnsubmit”>提交表单< / button>.在我的JavaScript中,我将有一个.on(‘submit’,function(e){…});抓住表单提交的事件,但由于另一个无法解释的原因,这似乎不起作用.
这是我的表格:
<form ID="registerForm" method="post" action="#" > <div data-role="fIEldcontain" > <label for="regLang" data-translation="reg_language"></label> <select ID="regLang" name="Language"> <!--<option value="0">EN</option>--> <option value="1">NL</option> <option value="2">FR</option> <!--<option value="3">DE</option>--> </select> </div> <div data-role="fIEldcontain" > <label for="regCode">Registration Code:</label> <input type="text" name="RegistrationCode" placeholder="Registration Code" data-translation="reg_code" ID="regCode" /> </div> <div data-role="fIEldcontain" > <label for="regEmail">E-Mail Address:</label> <input type="email" name="EmailAddress" placeholder="Email Address" data-translation="reg_email" ID="regEmail" /> </div> <div data-role="fIEldcontain" > <!--<label for="regPassword">Password:</label>--> <input type="password" name="Password" placeholder="Password" data-translation="reg_password" ID="regPassword" /> </div> <div data-role="fIEldcontain" > <button type="button" ID="regRegister"> <span data-translation="reg_register"></span> </button> </div></form>
这应该是触发我的表单的代码:
$("#registerForm").submit(function (e) { console.log("I don't even make it insIDe.");});
当我按下您在图像上看到的提交按钮时,表单将提交并浏览上面的代码.然而,当我按下“Registreren”按钮时,什么都不会发生.
现在我知道你们会说,只需在按钮上添加一个onclick事件并抓住表单提交,但那时我只会遇到我的第一个问题.该按钮似乎并不总是被触发..
更新
根据要求,以下是我的index.HTML页面如何查看其他脚本的概述:
<head> <Meta charset="UTF-8" /> <Title>Application</Title> <Meta name="vIEwport" content="wIDth=device-wIDth,initial-scale=1,maximum-scale=1,user-scalable=0" /> <Meta name="apple-mobile-web-app-capable" content="yes"> <Meta name="format-detection" content="telephone=no"> <!-- Jquery --> <link rel="stylesheet" href="jquery-mobile/jquery.mobile-1.3.0.min.CSS" type="text/CSS" /> <!-- simple dialog --> <link rel="Stylesheet" href="jquery-mobile/jquery.mobile.simpledialog.min.CSS" type="text/CSS" /> <link href="styles/main_absolute.CSS" rel="stylesheet" type="text/CSS" /> <link rel="stylesheet" href="styles/Font-awesome.min.CSS" type="text/CSS" /> <link href="styles/app.CSS" rel="stylesheet" type="text/CSS" /> <link href="jquery-mobile/jquery-ui/themes/base/jquery.ui.all.CSS" rel="stylesheet" type="text/CSS" /> <link href="slickgrID/jquery-ui-1.8.16.custom.CSS" rel="stylesheet" type="text/CSS" /> <script> // Prevent default errors at start of application when running in browser. // However,still shows other exceptions that are needed to deBUG the application. // NOTE: comment this code if you're building the ios or androID app (or windows) // (function () { // var ConsoleBasednativeAPI = { // exec: function(brIDgeSecret,service,action,callbackID,argsJson) { // return console.log(argsJson,'gap:'+JsON.stringify([brIDgeSecret,callbackID])); // },// setNativetoJsBrIDgeMode: function(brIDgeSecret,value) { // console.log(value,'gap_brIDge_mode:' + brIDgeSecret); // },// retrIEveJsMessages: function(brIDgeSecret,fromOnlineEvent) { // return console.log(+fromOnlineEvent,'gap_poll:' + brIDgeSecret); // } // }; // window._cordovaNative = ConsoleBasednativeAPI; // })(); </script> <script src="cordova.Js" type="text/JavaScript"></script> <script src="http://crypto-Js.Googlecode.com/svn/Tags/3.0.2/build/rollups/md5.Js" type="text/JavaScript"></script> <script src="Js/lib/jquery-mobile/jquery-1.8.2.min.Js" type="text/JavaScript"></script> <script src="Js/lib/jquery-mobile/jquery.mobile-1.3.0.min.Js" type="text/JavaScript"></script> <!-- <script src="Js/lib/jquery-mobile/jquery.mobile-1.4.2.Js" type="text/JavaScript"></script> --> <script src="Js/lib/jquery-mobile/jquery-drag/jquery.event.drag-2.2.Js" type="text/JavaScript"></script> <!-- jquery progress bar --> <link href="styles/jqm-progress-bar/jQMProgressbar.CSS" rel="stylesheet" type="text/CSS" /> <script src="Js/lib/jquery-mobile/jquery.mobile.simpledialog2.min.Js" type="text/JavaScript"></script> <!--simple dialog--> <script src="Js/lib/jqm-progress-bar/jQMProgressbar.Js" type="text/JavaScript"></script> <!-- SlickgrID --> <link href="slickgrID/slick.grID.CSS" rel="stylesheet" type="text/CSS" /> <link href="slickgrID/controls/slick.pager.CSS" rel="stylesheet" type="text/CSS" /> <script src="slickgrID/slick.core.Js" type="text/JavaScript"></script> <script src="slickgrID/slick.grID.Js" type="text/JavaScript"></script> <script src="slickgrID/slick.datavIEw.Js" type="text/JavaScript"></script> <script src="slickgrID/controls/slick.pager.Js" type="text/JavaScript"></script> <!-- toastr --> <link href="Js/lib/toastr/toastr.min.CSS" rel="stylesheet" type="text/CSS" /> <script src="Js/lib/toastr/toastr.min.Js" type="text/JavaScript"></script> <!-- moment --> <script src="Js/lib/moment.min.Js" type="text/JavaScript"></script> <!-- Underscore --> <script src="Js/lib/underscore.min.Js" type="text/JavaScript"></script> <script src="Js/lib/jquery-plugins/data-selector.Js" type="text/JavaScript"></script> <!-- statusbar --> <script src="Js/lib/statusbar.Js" type="text/JavaScript"></script> <!-- Own libs --> <script src="Js/app/namespace.Js" type="text/JavaScript"></script> <script src="Js/app/translation.Js" type="text/JavaScript"></script> <script src="Js/app/toast.Js" type="text/JavaScript"></script> <script src="Js/app/config.Js" type="text/JavaScript"></script> <script src="Js/app/settings.Js" type="text/JavaScript"></script> <script src="Js/app/utils.Js" type="text/JavaScript"></script> <script src="Js/app/database.Js" type="text/JavaScript"></script> <script src="Js/app/grID.Js" type="text/JavaScript"></script> <script src="Js/app/sIDebar.Js" type="text/JavaScript"></script> <script src="Js/app/logo.Js" type="text/JavaScript"></script> <script src="Js/app/news.Js" type="text/JavaScript"></script> <script src="Js/app/registration.Js" type="text/JavaScript"></script> <script src="Js/app/sync.Js" type="text/JavaScript"></script> <script src="Js/app/login.Js" type="text/JavaScript"></script> <script src="Js/app/cart.Js" type="text/JavaScript"></script> <script src="Js/app/productdetail.Js" type="text/JavaScript"></script> <script src="Js/app/customer.Js" type="text/JavaScript"></script> <script src="Js/app/recipe.Js" type="text/JavaScript"></script> <script src="Js/app/endlessgrID.Js" type="text/JavaScript"></script> <script src="Js/app/visitreports.Js" type="text/JavaScript"></script> <script src="Js/app/reports.Js" type="text/JavaScript"></script> <script src="Js/app/progresshandler.Js" type="text/JavaScript"></script> <script src="Js/app/departments.Js" type="text/JavaScript"></script> <!-- iScroll --> <script src="Js/lib/iscroll/iscroll.Js" type="text/JavaScript"></script> <script src="Js/lib/iscroll/jquery.mobile.iscrollvIEw.Js" type="text/JavaScript"></script> <link href="Js/lib/iscroll/jquery.mobile.iscrollvIEw.CSS" rel="stylesheet" type="text/CSS" /> <link href="Js/lib/iscroll/jquery.mobile.iscrollvIEw-pull.CSS" rel="stylesheet" type="text/CSS" /> <script type="text/JavaScript"> $(document).bind("mobileinit",function(){ $.mobile.hashListeningEnabled = false; }); </script> <script src="Js/app/app.Js" type="text/JavaScript"></script> <!-- DeBUGger --> <!--<script src="http://192.168.100.199:8080/target/target-script-min.Js#anonymous"></script>--> <!--<script src="http://192.168.16.125:8080/target/target-script-min.Js#anonymous"></script>--> <!-- <script src="http://deBUG.phonegap.com/target/target-script-min.Js#bee0a570-a515-11e3-8d7c-22000a98b3d6"></script> --></head><body> Content is probably not relevant and also way too long</body>解决方法 在regRegister按钮上放置动作
的onclick = “yourFunction中()”
并阅读:How to add function on button in phonegap?
总结以上是内存溢出为你收集整理的Cordova表单不提交或按钮不起作用(android 4.4)全部内容,希望文章能够帮你解决Cordova表单不提交或按钮不起作用(android 4.4)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)