javascript - JQuery change CSS style of table cells which contain disabled elements -


with jquery, how can select , change css style of text elements inside table cells contain disabled "input" and/or "select" elements?

i need iterate on cells in table, see if there disabled "input" and/or "select" elements in there, , if case, text in particular cell should "dimmed" setting css property opacity=0.5.

the solution must work in reasonably modern browsers.

use jquery :has() , :disabled pseudo-selectors on td elements:

$('td:has(:disabled)').css('opacity', .5); 

if need more specific disabled elements (probably not needed), use :input (:input covers both select , input):

$('td:has(:input:disabled)').css('opacity', .5); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -