Remove by id and class from the selected elements - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:not

Description

Remove by id and class from the selected elements

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").not(".intro, #outro").css("background-color", "yellow");
});//from www. ja  v  a  2 s  .  co  m
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>

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

</body>
</html>

Related Tutorials