好了朋友们,
这是我为实现这一目标所做的工作。
<style>
/* Tooltip container */
.tooltipPopup {
/*position: relative; */
/* display: inline-block;*/
/* border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ */
}
/* Tooltip text */
.tooltipPopup .tooltiptextPopup {
visibility: hidden;
width: 120px;
background-color: red;
color: white;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltipPopup:hover .tooltiptextPopup{
visibility: visible;
}
</style>
<form action="" id="myform" >
<p class="tooltipPopup">
E-mail
<input name="email" data-validation="email" >
<!-- <input name="email" data-validation="email" data-validation-error-msg-container='item-price-error-dialog' >
<span id="item-price-error-dialog"></span> -->
</p>
<p>
<input value="Validate" type="submit">
<input value="Reset form" type="reset">
</p>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<script>
// initialize validate plugin on the form
$.validate({
// errorElementClass:'tooltip',
errorMessageClass:'tooltiptextPopup'
});
</script>
在这里,我设置errorMessageClass
为tooltiptextPopup
and<p class="tooltipPopup">
以便它可以掩盖我的工具提示。
希望这对陷入相同情况并希望在不包含任何第三方库的情况下实现相同的人有所帮助。
谢谢