jquery - 为什么 anchor 不显示手形光标?

标签 jquery jquery-selectors

接着我的上一个问题。我现在有这个:

<a id='testOne'>One</a>

还有这个 JavaScript:

//To remove the title and default action.
$("#testOne").attr("title", "").click(function(e){
  e.preventDefault();
}).attr("onclick", null);

//To reset the title and action
$("#testOne").attr("title", "Test One").click(function(e){
  doTest('one');
});

但是当我的链接(样式像按钮)被重置时,光标是十字准线而不是指针。我检查了一下,它被设置为auto。有什么方法可以将其设置为指针吗?

最佳答案

那是因为 anchor 标记中没有 href 属性。试试这个

<a id='testOne' href="#">One</a>

或者

<a id='testOne' href="javascript:void(0);">One</a>

关于jquery - 为什么 anchor 不显示手形光标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6973058/

相关文章:

javascript - 如何在右键单击拖动时禁用上下文菜单?

javascript - 在 html 页面中的 2 个元素之间画线

jQuery : How to load a function after some interval or after end of another function or event

jquery - 这是 jquery 的有效 HTML

javascript - 关闭按钮在 div 内的 jQuery 中不起作用

javascript - 我如何决定哪些客户端可以看到页面,哪些客户端不能

javascript - 为什么我的 javascript 图片库没有加载?

jQuery 链接parent(),有更简单的方法吗?

jquery - 当选择器是 JS 变量时如何使用 jQuery hasClass

jquery - 使用 jQuery 获取下拉列表中选定的值。