I have HTML something like this:
<table>
<tr>
<td><div class='record'>Record Link</div></td>
<td><div class='delete' style='display:none;'>Delete Link</div></td>
</tr>
<tr>
<td><div class='record'>Record Link</div></td>
<td><div class='delete' style='display:none;'>Delete Link</div></td>
</tr>
</table>
Delete Link is hidden in above HTML. I want to show Delete Link when mouseover on its related record DIV
After trying some basic tutorials of prototypejs, I am able to write following code which is working for me but not completed.
document.on('mouseover', 'div.record', function(event, element) {
event.target.hide(); // testing: it hides the record itself
});
Following codes are not working for me:
$('delete').setStyle({ display: 'block' });
$$('div.delete').setStyle({ display: 'block' });
In Prototype, by setting
$("delete")you are calling element with iddeletewhich i dont see anywhere.You need to set the
<div id='delete' style='display:none;'>Delete Link</div>and use the following to bind events and start your script unobtrusively,
EDIT Since there many div.delete use the $$() selector as follows
If you want to hide on
mouseoversetdisplay:noneinstead ofdisplay:blockYou can also use
visibility:hiddenbut that will still occupy space on your html asan area portion