JSFiddle - React, Tailwind, and code Playground
by taylorRichie
HTML
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<form>
<fieldset>
<div>
<label for="studentID">
<input type="radio" id="studentID" name="searchBy" tabindex="1" /> Student ID</label> <span title="Enter Student ID number below">?</span>
</div>
<div>
<label for="studentName"><input type="radio" id="studentName" name="searchBy" tabindex="2" /> Lastname</label> <span title="Enter Student name below">?</span><br/>
</div>
<div>
<label for="studentEmail"><input type="radio" id="studentEmail" name="searchBy" tabindex="3"/> Address</label> <span title="Enter Student Email address below">?</span>
</div>
</fieldset>
</form>
<button id="triggerFunction">I'm a button</button><br><br>
<hr>
<a href="#"><span id="advisee" title="you have no advisees for the term selected, yadda yadda">View Advisee Listing</span></a>
CSS
body{font-family: arial, sans-serif;}
span{display:inline-block;}
label{display: inline-block;}
.ui-tooltip {
position:absolute;
background-color: #FFF6CF;
border: 1px solid #C3A876;
color: #333;
opacity:0;
width: auto;
height: auto;
margin: 20px;
padding: 10px;
box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.ui-tooltip:after, .ui-tooltip:before {
right: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ui-tooltip:after {
border-color: rgba(255, 246, 207, 0);
border-right-color: #FFF6CF;
border-width: 10px;
top: 50%;
margin-top: -10px;
}
.ui-tooltip:before {
border-color: rgba(195, 168, 118, 0);
border-right-color: #C3A876;
border-width: 11px;
top: 50%;
margin-top: -11px;
}
JavaScript
$(function(){
$("span").tooltip({
show: null,
position: {
my: "left+20 center",
at: "right center"
}, open: function( event, ui ) {
ui.tooltip.animate({
opacity:1,
left: ui.tooltip.position().left - 10
}, 200 );
}
});
$('input').focusin(function(){
$(this).parent().siblings('span').tooltip("open");
}).focusout(function(){
$(this).parent().siblings('span').tooltip("close");
});
});
$( document ).tooltip();
$('#triggerFunction').click(function(){
$('#advisee').tooltip("open");
});