3

Here is my Html code,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

  <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>
<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

3
  • 1
    Did you get any error in the Javascript console? Commented Jul 25, 2014 at 1:10
  • why it is not working? any error? Commented Jul 25, 2014 at 1:10
  • nope, no error.I create another file like this and I run, I worked.But In that index.html, it's not working Commented Jul 25, 2014 at 1:19

1 Answer 1

5

Oh buddy, don't use hash when declaring an id on your html code.

e.g.

 <li><a href="#" id="aboutus">About Us</a></li>

That should do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.