我是JQuery手机和Cordova的新手,我用JQuery手机创建了一个简单的Cordova应用程序,它有一个带有简单文本字段和收音机input.However的表单,当我输入一些文本并单击单选按钮时,我注意到应用程序运行时出现了一个问题,我注意到焦点仍然放在文本上,input.If JQuery手机没有使用,焦点将从文本输入中取出,我知道JQuery手机为这些表单元素添加了一些默认样式。我不希望焦点出现在文本字段中,当我选择在this.My页面上选择无线电button.Please帮助我时,下面给出了this.My代码。
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/jquery.mobile-1.4.5.min.css" rel="stylesheet">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div>
<form>
<label for="text-basic">Text input:</label>
<input type="text" name="text-basic" id="text-basic" value="">
<fieldset data-role="controlgroup">
<legend>Radio buttons, vertical controlgroup:</legend>
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" checked="checked">
<label for="radio-choice-1">Cat</label>
<input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2">
<label for="radio-choice-2">Dog</label>
<input type="radio" name="radio-choice-1" id="radio-choice-3" value="choice-3">
<label for="radio-choice-3">Hamster</label>
<input type="radio" name="radio-choice-1" id="radio-choice-4" value="choice-4">
<label for="radio-choice-4">Lizard</label>
</fieldset>
</form>
</div>
</body>
</html>移动视图的屏幕截图附在下面。

在上面的图片中,即使我从单选按钮列表中选择了一个元素,您也可以看到Android键盘没有关闭。
发布于 2016-04-08 12:03:38
尝尝这个
$("input:radio").addEventListener('touchstart',function(e) {
$('input[type=text], textarea').focusout();
});当触摸输入类型收音机时,它会手动移除文本区域或文本输入的焦点。
或者试试这个
$("input:radio").addEventListener('touchstart',function(e) {
$(':focus').blur();
});https://stackoverflow.com/questions/35278521
复制相似问题