开发者

Changing text from separate links

开发者 https://www.devze.com 2023-01-20 11:18 出处:网络
I am trying to change the content inside a DIV from separate links when mouseover.The content is different with each link. I wanted the default content in the DIV to appear with mouseleave.I\'m having

I am trying to change the content inside a DIV from separate links when mouseover. The content is different with each link. I wanted the default content in the DIV to appear with mouseleave. I'm having trouble to figure this out with jquery. Can anyone point me in the right direction or have an example to help.

I figured out how to make the content change with mouseover, but I need help to return the original content with mouseleave.

Many thanks.

Here is my code:

&l开发者_开发知识库t;div id="CONTENT">My content needs to change here.</div>

<div id="nc_wrap2">

<a class="nc1" href="#">Link 1</a>
<a class="nc2" href="#">Link 2</a>
<a class="nc3" href="#">Link 3</a>
<a class="nc4" href="#">Link 4</a>
<a class="nc5" href="#">Link 5</a>



</div>  


Basic example using your html:

http://jsfiddle.net/XMXct/

---- edit based on comments ----

Try a switch statement: http://jsfiddle.net/rtE2a/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消