[jQuery] change onmouseover function call
hi there, have a puzzling one.
i have a fairly simple function call that we use to display tooltips
over certain image elements. we put the function call in the
onmouseover attribute of the image element.
looks like this:
<script>
function CreateTip( strTipMessage ) {
// GENERATE TOOLTIP
}
</script>
<img id="img" src="/images/image.jpg" onmouseover="CreateTip( 'this is
the tooltip' );" onmouseout="ClearTip();" />
what i would like to do is to change the tooltip that is displayed
when the image is clicked. So the code becomes:
<script>
function CreateTip( strTipMessage ) {
// GENERATE TOOLTIP
}
function ChangeTip( ) {
$( "#img").attr( "onmouseover", CreateTip( 'New ToolTip' ) );
}
</script>
<img id="img" src="/images/image.jpg" onmouseover="CreateTip( 'this is
the tooltip' );" onmouseout="ClearTip();" onclick="ChangeTip( );" />
this works when i click on the element - ie. the 'New tooltip' text is
displayed properly - but only if i keep my mouse pointer over the
image. my problem is that when i move the mouse off the image and
return it to the image, the OLD tooltip is displayed.
any help here would be really, well, helpful.
thanks a bunch... airyt