jquery

hi kindly help me here.....

i have written code like this to display hi when page gets loaded using jquery .
<html>
    <head>
    <script type="text/javascript" src="jquery-2.0.3.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("#b").load(function(){
    alert("hi");
    });
    });
    </script>
    </head>
    <body>
    .........
    ......
    ....
    </body>
    </html>

Open in new window

please correct it this code so as to display message.
shrikanthnkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shrikanthnkAuthor Commented:
please ignore above code and refer below code
<html>
    <head>
    <script type="text/javascript" src="jquery-2.0.3.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("#b").load(function(){
    alert("hi");
    });
    });
    </script>
    </head>
    <body  id="b">
    .........
    ......
    ....
    </body>
    </html>

Open in new window

0
GaryCommented:
.load is to load an external page

<html>
    <head>
    <script type="text/javascript" src="jquery-2.0.3.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
          alert("hi")
    });
    </script>
    </head>
    <body  id="b">
    .........
    ......
    ....
    </body>
    </html>

Open in new window


Don't be using jquery 2.0+ if you want to support older browsers.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shrikanthnkAuthor Commented:
thanks
0
Tony van SchaikFront-end Web developerCommented:
You can also do something with jQuery append, but it depends on what u want to do, error message, welcome message, pop up?

Example:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script>
        $( document ).ready(function() {
            $("#message").append("<h3>Hi</h3>");
        });

    </script>
</head>

<body>
<div id="message"></div>
</body>
</html>

Open in new window


jQuery .load is an AJAX call, if you want to load an HTML, XML, JSON file etc.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.