我在我的html页面上有这两个jquery脚本,其中一个加载更多结果(如分页),另一个回复用户消息,就像twitter一样!这个jquery出了什么问题?
回复作品(inserts username into textbox)
,当页面是默认的,但是当我加载更多结果时,加载的结果wnt将用户名插入文本框!这是两个脚本,
答复的jQuery:
function insertParamIntoField(anchor, param, field) {
var query = anchor.search.substring(1, anchor.search.length).split('&');
for(var i = 0, kv; i < query.length; i++) {
kv = query[i].split('=', 2);
if (kv[0] == param) {
field.val(kv[1]);
return;
}
}
}
$(function() {
$("a.reply").click(function (e) {
insertParamIntoField(this,"status_id",$("#status_id"));
insertParamIntoField(this,"reply_name",$("#reply_name"));
insertParamIntoField(this, "replyto", $("#inputField"));
$("#inputField").focus()
$("#inputField").val($("#inputField").val() + ' ');
e.preventDefault();
return false; // prevent default action
});
});
的loadmore jQuery脚本:
$(function() {
//More Button
$('.more').live("click",function()
{
var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="moreajax.gif" />');
$.ajax({
type: "POST",
url: "ajax_more.php",
data: "lastmsg="+ ID,
cache: false,
success: function(html){
$("ul.statuses").append(html);
$("#more" + ID).remove();
}
});
}
else
{
$(".morebox").html('The End');
}
return false;
});
});
编辑:当我加载更多的岗位,我点击回复页面被调用,以便加载的数据再次被隐藏起来!
有人吗? :((((((! – getaway 2010-09-21 08:49:36
pleaaaaaaaaaaaaaaase someone – getaway 2010-09-21 09:52:40
是否将回复按钮替换为从ajax调用中返回的html?如果它正在被替换......无论您附加到原始回复按钮的任何点击处理器将不存在 – bcm 2010-09-21 10:12:54