In my HTML, I have a <textarea>
enclosed within a <div>
, which in turn is inside another <div>
. The <textarea>
has an ID that can be referenced, but the parent <div>
s do not have IDs. However, they always have a specific class assigned to them. There could be multiple instances of this structure on the same page, with only the <textarea>
having a unique ID:
<div class = "grandparent">
<div class = "parent">
<textarea id = "id_1"></textarea>
</div>
</div>
<div class = "grandparent">
<div class = "parent">
<textarea id = "id_2"></textarea>
</div>
</div>
I am unable to modify this existing structure. Is it feasible for me to apply styles to the grandparent <div>
using JQuery?
Edit: Just to clarify, I am interested in styling the grandparent element that contains a particular <textarea>
.