hi kindly help me here.....

i have written code like this to display hi when page gets loaded.
please correct it this code so as to display message.

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

Recommended Answers

<html>
<head>
<script type="text/javascript">
alert("hi");
</script>
</head>
<body>
.........
......
....
</body>
</html>
Jump to Post

All 3 Replies

small correction to the above code... please read <body> as <body id="b">

<html>
<head>
<script type="text/javascript">
alert("hi");
</script>
</head>
<body>
.........
......
....
</body>
</html>

@shrikanthnk-is there something else you have in mind because it seems like this is too simplistic of an example. As you can see from paulkd's example, there is no need to incorporate jQuery to simply generate an alert to say "Hi" on page load.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.