![]() |
VOOZH | about |
$("[attribute_name]")
Parameter:
In the above example, all the elements with the specified attribute (class) are formatted into green color i.e, "GeeksforGeeks", "Geek2" and "Thank You!". Example-2:
<!DOCTYPE html>
<html>
<head>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("[class]").css("color",
"green");
});
</script>
</head>
<body>
<center>
<!-- Class(demo) attribute-->
<h3 class="demo">GeeksforGeeks</h3>
<p>A computer science portal for geeks</p>
<!--id attribute-->
<p id>Geek1</p>
<p>Geek2</p>
<!--class(test) attribute-->
<p class="test">Geek3</p>
<!--class(sample) attribute-->
<div class="sample"> Thank You! </div>
</center>
</body>
</html>