我想在鼠标悬停或悬停时显示日期,现在是 onclick,我已经使用工具提示来显示数据,但我想在鼠标悬停时显示数据,我尝试了很多但没有成功?任何机构都可以提供帮助,我们将不胜感激,提前致谢。
这是我的代码,它想在单击鼠标悬停/悬停时进行更改。
<script>
$(".ajax_link").click(function(e) {
e.preventDefault(); //Stops link from changing the page
var link = $(this).attr('href'); //Gets link url
$.ajax({ //Make the ajax request
url: link,
cache: false
}).done(function( html ) { //On complete run tooltip code
//Display tooltip code goes here, returned text is variable html
.done(function( html ) {
alert("text: " + html);
});
});
});
</script>
您可以尝试更改此设置:
$(".ajax_link").click(function(e) {
to this:
$(document).on('hover mouseover mouseenter', ".ajax_link", function(e) {
//e.preventDefault(); //<-------you can take this out no need for this
如果你想停止页面跳转可以这样做:
$(".ajax_link").click(function(e) {
e.preventDefault(); // or return false;
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)