I have the following
<div class="comment-wrap">
<textarea></textarea>
</div>
Whenever the textarea is in focus, I want to style the comment-wrap div. I’ve tried:
#hallPost-inner + textarea:focus {
background: red;
}
This does not work. Any ideas on how I can style the comment-wrap div whenever the textarea is in focus, meaning the cursor is blinking in the textarea and the user can type?
Thanks
Not sure what
#hallPost-inneris, but in general CSS selectors cannot ascend, meaning you would need to have thetextarea:focusselector, but then would need to style an ancestor element, which cannot be done in css. Here’s a good resource, among many others. The link shows how an easy javascript solution can be achieved as well.