开发者

Get JavaScript working in a reloaded AJAX box

开发者 https://www.devze.com 2022-12-31 02:57 出处:网络
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

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

精彩评论

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