Say I have a link like the following:
<a class="link" href="www.rich.com" onmouseover="go(this)">Link</a>
Is there a way to configure the onmouseover
event, calling go(this)
to run only a single time while still using the inline onmouseover=<some code>
notation? I want it defined inline, not with a JavaScript call.
Currently, I have this, but it is not what I want:
JavaScript
x
4
1
$(".link").one('mouseover', function(e) {
2
// do something
3
});
4
Advertisement
Answer
You can nullify the onmouseover
binding afterwards:
JavaScript
1
2
1
<a class="link" href="www.rich.com" onmouseover="go(this); this.onmouseover = null;">Link</a>
2