Filter element returned from document.getElementById() - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:filter

Description

Filter element returned from document.getElementById()

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").filter(document.getElementById("intro")).css("background-color", "yellow");
});//ww  w. j a v  a  2s .  c  o m
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<p>test</p>
<p id="intro">test</p>
<p>test</p>

</body>
</html>

Related Tutorials