javascript函数调用后,锚定标记停止工作

javascript函数调用后,锚定标记停止工作,javascript,jquery,html,Javascript,Jquery,Html,我正在使用一个javascript函数,这个函数保存ajax请求。 我还有一个锚标签。 页面加载时,将显示项目列表,并显示“添加新项目”按钮 1.when i click on and item then it shows item detail. 2.then i click on add new buttom and form to add item shown. 3.but when i again click on any item it works fine but after tha

我正在使用一个javascript函数,这个函数保存ajax请求。 我还有一个锚标签。 页面加载时,将显示项目列表,并显示“添加新项目”按钮

1.when i click on and item then it shows item detail.
2.then i click on add new buttom and form to add item shown.
3.but when i again click on any item it works fine but after that add 
new item stop working.
javascript函数:

function Detail(ths,e){
    $(ths).siblings().removeClass('active');
        $(ths).addClass('active');
    var id = $(ths).attr('id');
        storage.setItem('itemId',id);

if(!e.target)
    {
    var top = $(ths).position().top;
    $('.list').scrollTop(top-100);      
}

    if(!$(e.target).hasClass('action'))
    {
      $.ajax({
        url : "manage-details.php",
        type: "POST",
        data: {id:id} ,
        success: function(text) {          
             $("#rightsec").html(text);   
        }
      })
    }
}
锚码:

    <a title="Add Items" id="additems" class="" href="#!manage-items.php|add-items.php">
       <span >
       </span>
       <span >Add Items</span>
    </a>

以上两个代码都描述了整个情况。

在ajax之后添加的项目没有与JQuery事件绑定,您必须像这样绑定它们:

$( "body" ).on( "click", "h2", function() {
    // Do something
});
文件在此: