JQuery developers seem to have put a lot of effort into filtering HTML components out of tooltips … which, as someone who visits a website … is A Good Thing. But what’s a good security consideration can be a massive pain when building a website. I have a form which takes an internal ID number, and I have an image showing people how to find that internal ID number. I want a little question mark after the field name that pops up the image as a tooltip on mouseover events. And clears the image on mouseout.
JavaScript:
// Show finding equipment ID image "tooltip" $('#ShowEquipmentIDTip').hover( function(){ $('#FindingEID').css({ "display": "block" }); } ,function(){ $('#FindingEID').css({ "display": "none" }); } );
HTML:
<div class="col-md-2 col-sm-2 col-lg-2 col-xs-2 text-left"> <span><strong>Equipment ID(s): <a id="ShowEquipmentIDTip" href="#">(?)</a></strong></span> <div id="FindingEID" style="position: relative;top: 20;left: 60;width: 100%;height: 100%;z-index:99;display:none"><img src="/groomsGenerateCircuitReport/images/Tip-FindingEquipmentID.png" /></div> </div>
Moving your mouse over the ShowEquipmentIDTip a element displays the div which contains my image “tooltip” and moving the mouse away sets the display back to none.