如何使用 jQuery 滑鼠懸停時給超連結加下劃線?
要使用 jQuery 在滑鼠懸停時給超連結加下劃線,請使用 jQuery css() 屬性。使用 color text-decoration 屬性。
範例
您可以嘗試執行以下程式碼來了解如何使超連結在滑鼠懸停時加下劃線
<html>
<head>
<title>jQuery Hyperlink Decoration</title>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('a').hover(
function () {
$(this).css({"text-decoration":"underline"});
});
});
</script>
<style>
a {
text-decoration: none;
}
</style>
</head>
<body>
<a href="#">Demo text</a>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP