Setting value not working when hidden

I am trying to set the value of text area as shown below:

It works when I am not hiding the div. And it doesn’t work when I am hiding the div. Why? I want it to work when it’s always hidden

Could you say a it more about what you’re trying to do? What does “working” mean? If you hide the div, everything in it will be hidden too.

Yeah, this thing is going to be inside a form so I am wanting to use the values from the text area while submitting a form.

It’s hidden but we can see that the value is not populating if we inspect it.

How exactly are you trying to use the value?

This submitted the value when I added a form around the html you showed.