How to use *= operator in jQuery attribute selector ? Last Updated : 05 Sep, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report This article will show you an idea of using the *= operator in jQuery attribute selectors. The *= operator is used to select the sub-string attribute and apply operations on it. Syntax: $("div[myAttr*='GFG']").jQueryMethod({ // Code }) Approach: We will create HTML div elements with some attributes. We will use *= selector to select attributes with some specific values. After selecting the div elements, we will apply CSS styles to that element. Example 1: In this example, we will use the *= operation to select the elements with specific sub-string and add CSS styles using jQuery. The output image shows that the CSS styles are not applied for the class which does not have the "GFG" sub-string. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <script src= "https://code.jquery.com/jquery-3.5.0.js"> </script> <title> How to use *= operator in jQuery attribute selector? </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3> How to use *= operator in jQuery attribute selector? </h3> <div class="GFG1">Web Technology</div> <div class="GFG2">C Programming</div> <div class="GFG3">JavaScript</div> <div class="GFG4">Java Programming</div> <div class="GFG5">Angular.js</div> <div class="GFG6">Computer Network</div> <div class="divClass">Algorithm</div> <script> $(document).ready(function () { $( "div[class*='GFG']" ).css({ "background": "green", "color": "white", "width": "350px", "margin": "auto" }); }); </script> </body> </html> Output: Example 2: In this example, we will use the *= operation to select the elements with specific sub-string and add CSS styles using jQuery. The output image shows that the CSS styles are not applied for the class which does not have the "Geeks" sub-string with the "gfgid". HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <script src= "https://code.jquery.com/jquery-3.5.0.js"> </script> <title> How to use *= operator in jQuery attribute selector? </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3> How to use *= operator in jQuery attribute selector? </h3> <div gfgid="Geeks123">Web Technology</div> <div gfgid="Geeks">C Programming</div> <div gfgid="Geeks345">JavaScript</div> <div gfgid="Geeksfor">Java Programming</div> <div gfgid="GeeksforGeeks">Angular.js</div> <div gfgid="Geeks678">Computer Network</div> <div gfgid="divClass">Algorithm</div> <script> $(document).ready(function () { $( "div[gfgid*='Geeks']" ).css({ "background": "green", "color": "white", "width": "350px", "margin": "auto" }); }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to use OR Operation in jQuery Attribute Selectors ? V vkash8574 Follow Improve Article Tags : Web Technologies CSS CSS-Selectors CSS-Questions Similar Reads How to use OR Operation in jQuery Attribute Selectors ? In this article, we will see how to use OR operation in jQuery Attribute Selectors. To use the OR operation in the attribute selector, we will use the comma operator (,) on attributes or attribute values. Syntax: $(".class1, .class2, ...") { // Code } Approach: First we will create some HTML div ele 2 min read How to use input readonly attribute in jQuery ? Use jQuery methods to add the readonly attribute to the form input field. jQuery attr() Method: This method set/return attributes and values of the selected elements. If this method is used to return the attribute value, it returns the value of the first selected element.If this method is used to se 3 min read jQuery [attribute*=value] Selector jQuery ("[attribute*=value]") Selector is used to select all elements with attribute specified by attribute parameter that contains the word specified by the value parameter. Syntax: $("[attribute*='value']")Parameters: This selector has two parameters. attribute: attribute specifies the attributes 2 min read jQuery | [attribute=value] Selector The jQuery [attribute=value] selector is used to select and modify HTML elements with specified attribute and value. Parameter Values: attribute: Used to specify attribute to find. Value: Used to specify value to find. Syntax: $("[attribute=value]") Example-1: This example selects the elements havin 1 min read jQuery [attribute^=value] Selector The jQuery [attribute^=value] selector is used to select all elements with a given attribute specified by an attribute parameter that starts with the word specified by value parameter. Syntax: $("[attribute^='value']")Parameters: This selector contains two parameters which are listed below: attribut 2 min read How to select elements by attribute in jQuery ? jQuery is a lightweight JavaScript library. In the vanilla JavaScript language, the getElementById method is used to select an element. However, jQuery provides a much lighter alternative for the same purpose. The 'jQuery Selector' allows the user to manipulate HTML elements and the data inside it(D 2 min read Like