如何使用jQuery更改'text-decoration'属性?
要使用jQuery更改文本修饰属性,请使用jQuerycss()属性。
示例
您可以尝试运行以下代码,将text-decoration属性从下划线更改为上划线:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").on({
mouseenter: function(){
$(this).css({"text-decoration": "overline"});
}
});
});
</script>
<style>
p {
text-decoration: underline;
}
</style>
</head>
<body>
<p>Move the mouse pointer on the text to remove underline and add overline.</p>
</body>
</html>热门推荐
10 公司年终晚会祝福语简短
11 学生毕业季祝福语简短
12 项目总生日祝福语简短
13 给儿子祝福语简短霸气
14 新年的祝福语简短的
15 生日祝福语男孩 简短独特
16 姨父生日祝福语简短精辟
17 升学祝福语简短的个性
18 送菜的祝福语简短霸气