views:

40

answers:

5

I have some news links, when user moves on that I have to change text of paragraph containing news in details.

A: 

See jQuery Docs.

1st result for Google: jquery onmouseover.

mcandre
+3  A: 

It's simple:

$('a.newslink').bind('mouseover', function() {
   $('p#newsdetail').text('new text');
})
tambourine
what is new text??
nectar
It's a string, whatever you want. Detailed news, for example.
tambourine
A: 

I'm not positive if this is what you're asking, but try using jQuery's .html() method. It sets the innerHTML property for an element, and it'll let you change the text of a <p> element.

octopi
+1  A: 

Can you post some example code or what you are working with/what you have so far? Without that, I can only refer you to this page: http://api.jquery.com/mouseover/

SimpleCoder
I suspect the mouseenter and leave example from that link is what nectar wants.
Kathy Van Stone
A: 

see solution in action here: http://jsbin.com/asoka4/2

This is a really lazy way to do things =)

<script type='text/javascript'>
$( function() {
  $("#news li").hover(
    function () {
      $(this).attr('small',$(this).html());
      $(this).html($(this).attr('full'));
    },
    function () {
       $(this).html($(this).attr('small'));
    }
  );
});
</script>

  <ul id='news'>
    <li id='news1' full='<strong>this is the full news 1</strong>'>This is some news 1</li>
    <li id='news2' full='<del>This is the full news 2</del>'>This is some news 2</li>
    <li id='news2' full='<a href="http://www.google.com"&gt;Check google.com for this one!'>This is some news 3</li>
  </ul>
ruinernix