Trevor Arjeski
Trevor Arjeski

Reputation: 2168

jQuery fade in on mouseover

I know this is a bit trivial but I just picked up jQuery tonight to add a little somethin somethin to my practice website, BUT I just cant seem to get this little script I wrote to work. Thanks in advance.

$(document).ready(function(){
    $("p4").fadeTo("slow", 0.25);
    $("p4").mouseover(function(){$("p4").fadeTo("fast",1.00);});
    $("p4").mouseout(function(){$("p4").fadeTo("slow",0.25);});
    });


<div id="p4" align="left">
BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHfffffffffffffffffffffffffffffffffffffffffff
</div>

I also have some CSS

Upvotes: 1

Views: 708

Answers (2)

Trevor Arjeski
Trevor Arjeski

Reputation: 2168

When using jquery, you need to have libraries downloaded. Since most people dont have them unless they do heavy webdesign you have to import it from a host such as Google or Microsoft...

Using this code solved the problem:

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>

Thank all for your guidance! I appreciate it!

Upvotes: 0

thirtydot
thirtydot

Reputation: 228302

I imagine your HTML looks like <div id="p4"></div>.

So, you need to use $("#p4") everywhere to find an id, instead of $("p4") (which is actually looking for <p4></p4>).

http://jsfiddle.net/84k7e/

Upvotes: 3

Related Questions