I have a table and in every row I have a cell (Example, for first row: (id: ctl00_MainContent_grdSearch_i0_c5). I need to check if this cell has value 1 then disable its row (i.e. ctl00_MainContent_grdSearch_i0 in above case).
(id: ctl00_MainContent_grdSearch_itemsHolder)
row (id: ctl00_MainContent_grdSearch_i0)
row (id: ctl00_MainContent_grdSearch_i1)
row (id: ctl00_MainContent_grdSearch_i2)
You can use a single line to do this with the
:contains()selector. This example is assuming you’re usingdivelements the way you described in comments.If your HTML is a more complicated, you might want to be more specific and use the this line instead:
The first line finds any
divunder youritemsHolder divwith the value of1. The second line only findsdivelements with theidstarting withctl00_MainContent_grdSearch_ithat have the value of1.In this demo I set
background-color: gray;for the disabled rows so you could see them.Demo: http://jsfiddle.net/ThinkingStiff/MULSv/
HTML:
CSS:
Script:
Output: