我有一个处于禁用形式的单选按钮。我只想在该单选按钮被禁用时在悬停时显示一些文本。代码如下:
JavaScript:
$(document).ready(function(){
$('#content').on('mouseenter', 'input#Radio', showBox);
$('#content').on('mouseleave', 'input#Radio', hideBox);
function showBox(e){
var x = e.pageX + 20;
var y = e.pageY + 20;
$('#hoverbox').fadeIn();
$('#hoverbox').offset({ left: x, top: y });
}
});
function hideBox(){
$('#hoverbox').fadeOut();
}
CSS:
#hoverbox {
display:none;
position:absolute;
}
#text {
width:100px;
height:100px;
background:#000;
}
.pop-up-bc-tooltip {
float:left;
padding:14px 12px;
border:2px solid #626367;
font: normal 14px Arial, Helvetica, sans-serif;
-moz-border-radius: 2px;
border-radius: 2px;
background:#fffcfc;
}
HTML:
<div id="hoverbox" class="pop-up-bc-tooltip">
please complete the required fields above<br/>
prior to selecting your travel insurance
</div>
<div id="content">
<input type="radio" id="radiobtn"/>Hi
<div id="hoverbox" class="pop-up-bc-tooltip">
please complete the required fields above<br/>
prior to selecting your travel insurance
</div>
</div>