Here is my Html code,index.html
这是我的Html代码index.html
<body>
<div id="container">
<div id="header">
<div class="menu_div">
<ul id="menu-bar">
<div id="menu_div">
<li><a href="#" id="#home">Home</a></li>
<li><a href="#" id="#men">Men</a></li>
<li><a href="#" id="#women">Women</a></li>
<li><a href="#" id="#cosmetics">Cosmetics</a></li>
<li><a href="#" id="#accessories">Accessories</a></li>
<li><a href="#" id="#services">Services</a></li>
<li><a href="#" id="#aboutus">About Us</a></li>
</div>
</ul>
</div>
</div>
<div id="control">
<p style="position:relative;">Lorem Ipsum...</p>
</div>
</div>
</body>
Here is my Jquery code,to change external div
这是我的Jquery代码,用于更改外部div
<script type="text/javascript">
$(document).ready(function(){
$('#aboutus').click(function () {
$('#control').load('AboutUs.html #controlAboutUs') ;
});
});
</script>
and Here is my External Html.AboutUs.html
这是我的外部Html.AboutUs.html
<html>
<head>
<title>About us</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="controlAboutUs">
<div>
<h3>Welcome From Ivory's Collection</h3>
<p>
We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.We export Clothes,Accessories and Branded cosmetics from Japan Directly. We are fully guranteed for quality and designs.
</p>
</div>
</div>
</body>
</html>
I tried with simple code for that, it worked. But in this files, it is not working. I don't know why... pls help me
我尝试使用简单的代码,它有效。但在这个文件中,它无法正常工作。我不知道为什么......请帮助我
1 个解决方案
#1
5
Oh buddy, don't use hash when declaring an id on your html code.
哦伙计,在你的html代码上声明一个id时不要使用哈希。
e.g.
<li><a href="#" id="aboutus">About Us</a></li>
That should do it.
应该这样做。
#1
5
Oh buddy, don't use hash when declaring an id on your html code.
哦伙计,在你的html代码上声明一个id时不要使用哈希。
e.g.
<li><a href="#" id="aboutus">About Us</a></li>
That should do it.
应该这样做。