Change the font weight and color of paragraphs on mouseenter and mouseleave using jquery
- جي كويري
- 2021-09-18
- mhanasmh00489829403
الأجوبة
HTML Code:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Change the font weight and color of paragraphs on mouseenter and mouseleave.</title>
</head>
<body>
<p>Move the mouse over this and next pragraphs.</p>
<p>Web development tutorials</p>
</body>
</html>
JavaScript Code:
$( "p" )
.on( "mouseenter", function() {
$( this ).css({
"background-color": "red",
"font-weight": "bolder"
});
})
.on( "mouseleave", function() {
var styles = {
backgroundColor : "#ded",
fontWeight: ""
};
$( this ).css( styles );
});
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة