Home  >  Article  >  Web Front-end  >  Solve the problem of page js not being executed when using jquery load to load a page into a div_jquery

Solve the problem of page js not being executed when using jquery load to load a page into a div_jquery

WBOY
WBOYOriginal
2016-05-16 16:58:441009browse

jquery code:

Copy code The code is as follows:

$(function(){
$("#test").load("${contextPath}/notepad/toCreate.do");
}

Load ${contextPath}/notepad/toCreate. do page to the div with the ID of test. After the loading is completed, the js in the create page will not be executed

This method cannot be implemented, so try another way:

Copy the code The code is as follows:





js event:
Copy code The code is as follows:

function loadPage(){
window.open("${contextPath}/notepad/toCreate.do",'testLoad','');// testLoad is the name attribute of iframe
}

button :
Copy code The code is as follows:



When the button is clicked, the page is loaded into the iframe. The js inside is usable, but it doesn't feel very good. It's like refreshing the page. Same...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn