Javascript 如何更改加载在其他html';人体标签
我正在另一个页面中加载一个html页面,比如说,Javascript 如何更改加载在其他html';人体标签,javascript,jquery,html,Javascript,Jquery,Html,我正在另一个页面中加载一个html页面,比如说,home.html在index.html中被调用,但现在我想在index.html中的java脚本或jquery的帮助下更改home.html的一些内容 下面是我到目前为止所做的尝试 index.html <html> <body> </body> </html> <script> $('body').load('home.html'); // below d
home.html
在index.html
中被调用,但现在我想在index.html
中的java脚本或jquery的帮助下更改home.html
的一些内容
下面是我到目前为止所做的尝试
index.html
<html>
<body> </body>
</html>
<script>
$('body').load('home.html');
// below div **session_error** is from home.html page,I wanted to change its text on this page
$('#session_error').html("This is session out errror");
</script>
$('body').load('home.html');
//下面的div**session\u error**来自home.html页面,我想更改此页面上的文本
$('#session_error').html(“这是session out error”);
调用.load()
是异步的。因此,在进行更改之前,您需要等待它完成
比如:
$('body').load('home.html', function() {
$('#session_error').html("This is session out errror");
});
.load()
调用是异步的。因此,在进行更改之前,您需要等待它完成
比如:
$('body').load('home.html', function() {
$('#session_error').html("This is session out errror");
});
是
会话错误
还是会话错误
?似乎有一个输入错误load
有一个回调<代码>$('body').load('home.html',function(){//do stuff here})代码>是会话错误
还是会话错误
?似乎有一个输入错误load
有一个回调<代码>$('body').load('home.html',function(){//do stuff here})代码>