Input jquery输入单击功能未触发
我尝试将脚本更改为以下内容,但仍然无法触发事件。。我错过什么了吗Input jquery输入单击功能未触发,input,jquery-mobile,click,jquery,Input,Jquery Mobile,Click,Jquery,我尝试将脚本更改为以下内容,但仍然无法触发事件。。我错过什么了吗 $('#page1').live('pageshow',function(event) { $("#radioyes").click(function(){ $("p").hide(); }); }); 我也尝试了pagebeforecreate,但结果是一样的( 我正在尝试一个简单的jquery移动页面,并在chrome portable上进行测试。但是,在下面的代码
$('#page1').live('pageshow',function(event) {
$("#radioyes").click(function(){
$("p").hide();
});
});
我也尝试了pagebeforecreate
,但结果是一样的(
我正在尝试一个简单的jquery移动页面,并在chrome portable上进行测试。但是,在下面的代码中,当按钮单击起作用时,input click事件不起作用。我还尝试了
“input#radioyes”
作为“div>字段集>input#radioyes”
,但仍然不起作用
<!DOCTYPE html>
<html>
<head>
<title>Background check </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="images/touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="images/touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="images/touch-icon-iphone4.png" />
<script type="text/javascript" src="jQuery/jquery.js"></script>
<script type="text/javascript" src="jQuery/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="jQuery/jquery.mobile.min.css" />
<!-- JQuery Date Picker components -->
<link rel="stylesheet" href="jQuery/jquery.ui.datepicker.mobile.css" />
<script src="jQuery/jQuery.ui.datepicker.js"></script>
<script src="jQuery/jquery.ui.datepicker.mobile.js"></script>
<link rel="stylesheet" href="css/folo.css" />
<script type="text/javascript">
$('#page1').live('pageshow',function(event) {
$("#radioyes").click(function(){
$("p").hide();
});
});
</script>
</head>
<body >
<div data-role="page" id="page1" data-theme="a" data-title="PAGE1">
<div data-role="header">
<h1>"PAGE1"</h1>
</div><!-- /header -->
<div data-role="content" >
<p> Welcome. </p>
<div id="SSN">
<label for="basic">SSN: </label>
<input name="ssn" id="textSSN" value="" data-theme="a" />
</div>
<div id="first">
<label for="first">First Name:</label>
<input name="input_first" id="input_first" value="" data-theme="d" />
</div>
<div id="last">
<label for="last">Last Name:</label>
<input name="input_last" id="input_last" value="" data-theme="d" />
</div>
<button id="btn1">Click me</button>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-role="fieldcontain">
<legend>Have you used other last name?</legend>
<input type="radio" name="radio-choice" id="radioyes" value="yes" />
<label for="radioyes">Yes</label>
<input type="radio" name="radio-choice" id="radio-no" value="No" checked="checked" />
<label for="radio-no">No</label>
</fieldset>
<div id="otherlast">
<label for="otherlast">Other Last Name:</label>
<input name="input_otherlast" id="input_otherlast" value="" data-theme="d" />
</div>
</div>
<div id="dob">
<label for="date">Date Of Birth:</label>
<input type="date" class="datepicker" name="date" id="my_date" value="01/19/1975" text="01/19/1975" />
</div>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
</html>
背景调查
$('#page1').live('pageshow',函数(事件){
$(“#radioyes”)。单击(函数(){
$(“p”).hide();
});
});
“第1页”
欢迎光临
SSN:
名字:
姓氏:
点击我
你用过其他姓吗?
对
不
其他姓氏:
出生日期:
感谢您的帮助。Jquery的版本已下载1.7.1 1.6.4,Jquery mobile是最新版本。您不能在Jquery mobile中使用$(文档)。就绪
这里还有一个答案- jQM 1.0不支持jQuery 1.7.x请使用jQuery 1.6.4()
- jQM使用pageInit(),而不是$(document).ready()()
$(“p”).hide();
可能会按预期隐藏,但其他标记可能仍然可见。我建议对span元素使用id
更新:
试试这个
$('#page1').live('pageshow',function(event) {
$("#radioyes").bind( "change", function(event, ui) {
$("p").hide();
});
});
实例: