JSFiddle - React, Tailwind, and code Playground
by Terry Mun
HTML
<button type="button">Hide if CSS background matches regex <code>/1600x50/g</code></button>
<div class="bg"></div>
<div class="bg"></div>
<div class="bg"></div>
<div class="no-bg" style="background-image: url('http://placehold.it/1600x50')"></div>
<div class="no-bg"></div>
<div class="bg"></div>
<div class="bg"></div>
<div class="no-bg"></div>
CSS
div {
background-color: #333;
width: 100%;
height: 40px;
margin-bottom: 20px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
.bg {
background-image: url('http://placehold.it/1600x50');
}
JavaScript
$('button').click(function() {
var pattern = new RegExp("http:\/\/placehold\.it", "gi");
$('div').filter(function() {
return $(this).css('background-image').match(pattern);
}).slideUp(500);
});