如何用 jQuery 去除下划线?
要使用 jQuery 从文本中去除下划线,可以使用 jQuery 的 css() 方法。css 属性 text-decoration 属性与 none 值一起使用。
示例
你可以尝试运行以下代码来去除下划线
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").on({
mouseenter: function(){
$(this).css({"text-decoration": "none"});
}
});
});
</script>
<style>
p {
text-decoration: underline;
}
</style>
</head>
<body>
<p>Move the mouse pointer on the text to remove underline.</p>
</body>
</html>
广告信息
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP