Q:

Change the font weight and color of paragraphs on mouseenter and mouseleave using jquery

0

Change the font weight and color of paragraphs on mouseenter and mouseleave using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now