We would like to know how to remove selected elements by class.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--from ww w . ja va 2 s . co m-->
$(".foo").filter(".bar").css('background-color', 'red');
});
</script>
</head>
<body>
<div class="foo bar">div1</div>
<div class="foo">div2</div>
<div class="bar">div3</div>
</body>
</html>
The code above is rendered as follows: