Scenario
Assume you have many divs in your aspx page and you have some string values inside these DIVs. Now let say you want to check if a DIV has "XXX" string values that make the background colorful. The following is my ASPX to do that:
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Contains_In_jQuery.Default" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Contains in jQuery</title>
- <script src="Scripts/jquery-2.1.4.min.js"></script>
- <script>
- $(document).ready(function () {
- $("div:contains('AMX')").css("background-color", "red");
- });
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>Amol Malhotra - AMX</div>
- <div>Shambhu Sharma - AMX</div>
- <div>Hemant Chopra - HWN</div>
- <div>Rahul Saxena - AMX</div>
- <div>Yogesh Gupta - AMX</div>
- <div>Shraddha Gaur - AMX</div>
- <div>Abhishek Nigam - HWN</div>
- <div>Shweta Kashyap - AMX</div>
- <div>Saurabh Mehrotra - PHNX</div>
- <div>Mayank Dhulekar - USA</div>
- <div>Mehak Jain - HWN</div>
- <div>Rakesh Dixit - AMX</div>
- <div>Akhilesh Atwal - KS</div>
- </form>
- </body>
- </html>

Figure 1
If you want to set more than one setting in CSS properties:
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Contains_In_jQuery.Default" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Contains in jQuery</title>
- <script src="Scripts/jquery-2.1.4.min.js"></script>
- <script>
- $(document).ready(function () {
- //$("div:contains('AMX')").css("background-color", "red");
- $("div:contains('AMX')").css({ "background-color": "yellow", "font-size": "140%", "color":"red" });
- });
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>Amol Malhotra - AMX</div>
- <div>Shambhu Sharma - AMX</div>
- <div>Hemant Chopra - HWN</div>
- <div>Rahul Saxena - AMX</div>
- <div>Yogesh Gupta - AMX</div>
- <div>Shraddha Gaur - AMX</div>
- <div>Abhishek Nigam - HWN</div>
- <div>Shweta Kashyap - AMX</div>
- <div>Saurabh Mehrotra - PHNX</div>
- <div>Mayank Dhulekar - USA</div>
- <div>Mehak Jain - HWN</div>
- <div>Rakesh Dixit - AMX</div>
- <div>Akhilesh Atwal - KS</div>
- </form>
- </body>
- </html>

Figure 2
You can use more than one check as in the following:
- <script>
- $(document).ready(function () {
- //$("div:contains('AMX')").css("background-color", "red");
- $("div:contains('AMX')").css({ "background-color": "yellow", "font-size": "100%", "color": "red" });
- $("div:contains('HWN')").css({ "background-color": "Skyblue", "font-size": "100%", "color": "white" });
- });
- </script>

Figure 3


Rahul Kumar SaxenaTOP 100Posted Jul 23, 2015, 7:33 PM EDT
Thanks Santhakumar Munuswamy
Rahul Kumar SaxenaTOP 100Posted Jul 23, 2015, 7:33 PM EDT
Thanks Debasis Saha
Santhakumar MunuswamyPosted Jul 23, 2015, 11:13 AM EDT
Thanks for nice article:)
Debasis SahaTOP 100Posted Jul 20, 2015, 8:54 PM EDT
Good One..
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 9:36 AM EDT
Thanks Gopi Chand
Gopi ChandPosted Jul 20, 2015, 8:52 AM EDT
Nice article
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 6:53 AM EDT
Thanks Nilesh Jadav
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 6:53 AM EDT
Thanks Sibeesh Venu
Nilesh JadavPosted Jul 20, 2015, 5:48 AM EDT
Nice article sir
Sibeesh VenuTOP 100Posted Jul 20, 2015, 5:07 AM EDT
Good one :)
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 5:04 AM EDT
Thanks Sharad
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 5:04 AM EDT
Thanks Vipul Malhotra
Vipul MalhotraPosted Jul 20, 2015, 4:11 AM EDT
nice Article sir.Thanks for sharing
SharadPosted Jul 20, 2015, 4:02 AM EDT
nice..
Rahul Kumar SaxenaTOP 100Posted Jul 20, 2015, 3:54 AM EDT
Thanks Rakesh Chavda
RakeshPosted Jul 20, 2015, 3:35 AM EDT
Good one sir