I wanted to create a paragraph on which if a user hovers the mouse, it should display an alert box. But the code that I typed did not work. As soon as the mouse entered the page the box displayed. I only want it to display when the mouse is on the paragraph. The code was :
<html>
<script src="jquery.js" type="text/javascript"></script>
<script>
$('document').ready(function(){
$('#p1').hover(
alert("you have entered p1 .")
);
});
</script>
<body>
<p id="p1">hover here!!</p>
</body>
</html>
Working example on jsFiddle.
Try this:
or: