jQuery events not happening after AJAX load?

前端 未结 8 683
别跟我提以往
别跟我提以往 2021-01-22 13:59

I have a website that will fade out a section of my website, load new content in, and fadeIn. There\'s a feature I had where a picture would get big when you click on it (it\'s

8条回答
  •  无人及你
    2021-01-22 14:21

    This is because all your events that you write inside document ready will get executed only for the elements that are available at the time of page load.

    You will have to use .live() to bind events for all current and dynamically generated elements.

    Or you can bind the events once again in the success callback of your ajax function.

提交回复
热议问题