如何使用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 商业mc祝福语大全简短