开发者

Get JavaScript working in a reloaded AJAX box

When I use AJAX for part of my page, such as a commentbox, in the reloaded box no JavaScript works. e.g. like cutetime or whatever. So I guess I have to reload the cutetime command (in every reload of the commentbox)

It works, but I think I have the cutetime command twice. If I have a confirm box or anything other, I get the confirm box or the add command twice.

开发者_如何学运维I'll try to describe it in one sentence:

I need a way to get JavaScript working in a reloaded AJAX-Box.

P.S.: I think there is a very easy way because everybody uses it :)


If you replace an element anything attached to it is lost.

When using jQuery, you can avoid this issue by using live events. However, this doesn't work for plugins where you don't attach events. In that case you need to call whatever function enables something on your element again when replacing it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜