perhaps not the most efficient, but rather intuitive
$('textarea').css('border', '1px solid green'); $('div.red textarea').css('border', '1px solid red');
although something like this might be more in css if you try to apply it to all text fields at any time:
textarea { border: 1px solid green; } div.red textarea { border: 1px solid red; }
Edit:
As Paolo Bergantino notes, if you want to do something more complex than one css command in text areas, you can use
var redAreas = $('div.red textarea'); var otherAreas = $('textarea').not(redAreas);
source share