如何使用jQuery删除下划线?

要从jQuery中的文本中删除下划线,请使用jQuerycss()方法。css属性的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": "none"});
        }
    });    
});
</script>
<style>
p {
   text-decoration: underline;
}
</style>
</head>
<body>
<p>Move the mouse pointer on the text to remove underline.</p>
</body>
</html>