Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquerydom.$。html_Jquery_Html_Dom - Fatal编程技术网

jquerydom.$。html

jquerydom.$。html,jquery,html,dom,Jquery,Html,Dom,此链接也有jquery事件$(“a[href=#editInfo]”)。单击 但事件未被触发 如果将此链接放置在浏览器直接加载的位置(无DOM),则此链接有效。 通过DOM附加的链接不起作用:( 我怎么能修好它 对不起,我的英语不好。将“”添加到搜索属性值。 试试这个: <div class="row"> <li><a href="#editInfo">Change information</a></li> </div>

此链接也有jquery事件<代码>$(“a[href=#editInfo]”)。单击

但事件未被触发

如果将此链接放置在浏览器直接加载的位置(无DOM),则此链接有效。 通过DOM附加的链接不起作用:(

我怎么能修好它

对不起,我的英语不好。

将“”添加到搜索属性值。
试试这个:

<div class="row">
   <li><a href="#editInfo">Change information</a></li>
</div>

据我所知,
#editInfo
链接在加载页面时不存在,而是在单击
#profile
时加载。这意味着
editInfo
是一个动态元素,因此需要使用

$(“a[href='#editInfo'])。单击(函数(){仍然不起作用:(
<div class="row">
   <li><a href="#editInfo">Change information</a></li>
</div>
$("a[href='#sign-in']").click(function(){
    $.post("/index.php/start_ctrl/signin", function(data){
        $("body>div.row").html(data);
    })
})
$("a[href='#profile']").click(function(){
    $.post("/index.php/profile_ctrl/profile", function(data){
        $("body>div.row").html(data);
    })
})
$("a[href='#editInfo']").click(function(){
    $.post("/index.php/profile_ctrl/editinfo", function(data){
        $("div.profilepanel").html(data);
    })
})
$(document).on('click', "a[href=#editInfo]", function () {
    $.post("/index.php/profile_ctrl/editinfo", function (data) {
        $("div.profilepanel").html(data);
    })
})