How to use *= operator in jQuery attribute selector?

The *= operator is used to filter elements for attribute containing the given value.


You can try to run the following code to learn how to *= operator to filter attributes on the basis of text:

Live Demo

<!DOCTYPE html>
<script src=""></script>

   $( "div[myattr*='subject']" ).css("background-color", "yellow");

<div myid="sub1" myattr="javasubject">Java</div>
<div myid="sub2" myattr="htmlsubject">HTML</div>
<div myid="sub3" myattr="ruby">Ruby</div>