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()()
此外,jQM还会向页面添加其他标记,因此
$(“p”).hide();
可能会按预期隐藏,但其他标记可能仍然可见。我建议对span元素使用
id

更新:

试试这个

$('#page1').live('pageshow',function(event) { 
    $("#radioyes").bind( "change", function(event, ui) {
        $("p").hide();
    });
});
实例:

电台活动的文件:


您是否尝试过发出警报以查看其是否触发?我看不出任何原因导致该警报目前不起作用。似乎在JSFIDLE上起作用?在该示例中,您没有使用jquery mobileThanks获取信息。我将jquery版本更改为1.6.4,并将代码更改为上面的更新。它仍然不起作用。还有什么我遗漏的吗nks获取信息..我将Jquery版本更改为1.6.4,并将代码更改为上述更新..我尝试了pagebeforecreate、pageinit等。它仍然不起作用..我还缺少什么吗?删除live()并使用它:$(“#radioyes”)。单击(函数(){$((($).hide();});嗯..仍然不起作用。尝试了以下操作:$(“#radioyes”)。单击(function(){$((“p”).hide();});您使用的是什么版本的jQM?控制台中有错误吗?更新了我的答案,jQM文档说要绑定更改事件