I have some news links, when user moves on that I have to change text of paragraph containing news in details.
+3
A:
It's simple:
$('a.newslink').bind('mouseover', function() {
$('p#newsdetail').text('new text');
})
tambourine
2010-06-21 19:26:09
what is new text??
nectar
2010-06-21 19:35:59
It's a string, whatever you want. Detailed news, for example.
tambourine
2010-06-22 08:27:30
+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
2010-06-21 19:27:22
I suspect the mouseenter and leave example from that link is what nectar wants.
Kathy Van Stone
2010-06-21 19:36:11
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">Check google.com for this one!'>This is some news 3</li>
</ul>
ruinernix
2010-06-21 22:02:45