Use a jQuery method to add the "important" class to the <p> element. - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:addClass

Description

Use a jQuery method to add the "important" class to the <p> element.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("p").addClass("important");
});/*from ww  w.ja  va 2  s . c  o m*/
</script>
<style>
.important {
    font-weight: bold;
    font-size: xx-large;
    background-color: yellow;
}
</style>
</head>
<body>

<p>This is a paragraph.</p>

</body>
</html>

Related Tutorials