I seem to be unable to change the onmouseover attribute of a div using jquery. In the code below, lines 1 and 3 work fine but line 2 does nothing.
window.parent.$('#note' + appid + dbid).html('<img src="images/note_gray.png">');
window.parent.$('#note' + appid + dbid).attr('onmouseover','testestestsetset');
window.parent.$('#note' + appid + dbid).attr('title', 'testdata');
Using Chrome (13.0.772.0 dev-m) watching the developer tools. I see the two changes immediately as I should, the onmouseover never does anything.
The .net code uses onmouseover to do some weird javascript hover thing. I don’t want to go back and change all that functionality, so when I update a record I want it to change the hover tip to reflect the new data, without doing a page postback. This is why I am using onmouseover and trying to change it from jquery so please don’t ask “Why don’t you use x instead”. Thanks.
—EDIT—-
If it helps, this is what it looks like in HTML from the generated page that I am building edit functionality for. The original code uses a javascript function called “Tip” to generate a hovertip. This was written by someone else. I am doing edit modals for the page. When you submit a change, I want it to change the tooltip.
<div id="note1009872" class="dbnote" onmouseover="Tip('No Notes...')" onmouseout="UnTip()" title="testempty"><img src="images/note.png"></div>
You’re trying to bind an event property to a string. That isn’t going to get you far.
You need to bind it to a function, whether it is one that sits in the global namespace or is a closure:
Or:
Ok, turns out that you can bridge across frames like this, but that your execution space must remain in the calling frame unless named:
OR:
I’ve got sample code working from two iFrames and have tested it out.