JQuery Toggle Delete Icon

Hello Experts,

I've got some HTML (with inline styles - only in place for the design process)...

<tr style="background-color:#efefef;">
<td style="line-height:36px; font-size:12px; text-align:left; font-family:Arial, Helvetica, sans-serif; padding: 0px 8px; border:1px solid; border-color:#dedede; font-weight: bold;"><div style="position:relative;">Date: <%=RSNotes("Date")%>
  <a href="#"><img src="png/trashNew.png" width="13" height="15" alt="Delete" style="right:0px; position: absolute; top: 10px;" /></a></div></td>
</tr>

Open in new window


What I would like to do, is display:hidden this -

<a href="#"><img src="png/trashNew.png" width="13" height="15" alt="Delete" style="right:0px; position: absolute; top: 10px;" /></a>

Open in new window


but show it whenever a user hovers over the table row.....

the table row is part of a two row table. the table is in a repeat region..

Any suggestions?

Thanks
garethtnashAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ivo StoykovCommented:
Try this

HTH

Ivo Stoykov


<table border="1">
    <tr style="background-color:#efefef;" onmouseover="return a_show(this)" onmouseout="return a_hide(this)">
        <td style="line-height:36px; font-size:12px; text-align:left; font-family:Arial, Helvetica, sans-serif; padding: 0px 8px; border:1px solid; border-color:#dedede; font-weight: bold;">
            <div style="position:relative;">Date: <a href="#" style=" display:none">testlink</a>
            </div>
        </td>
    </tr>
</table>
<script>function a_show(el) {
    $(el).find('a').show();
}

function a_hide(el) {
    $(el).find('a').hide();
}</script>

Open in new window

0
Chris StanyonWebDevCommented:
You should avoid putting javascript 'inline'. Here's an unobtrusive way of doing it:

$('tr').hover(
	function() { $(this).find('a').hide() },
	function() { $(this).find('a').show() }
);

Open in new window

Wrap the code in your document.ready() block.

The code is very generic. It will work on hover() of ALL <tr> tags and hide ALL <a> tags within the hovered row. If you need to target specific tables or anchors then you'll need to add IDs or Classes and change the selectors accordingly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
garethtnashAuthor Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.