I have a small HTML page with two textarea
elements side-by-side. One is enabled for input and the other is readonly and dynamically shows a preview for the first one (for some custom template processing).
I want both textarea
elements to always have the same height and for them to match the other if the use resizes. I'm not using jQuery or any fancy JS framework, though I am using Bootstrap 5.
Can this be done with vanilla JS?
This is my code for the two textarea
s:
<div class="row">
<div class="col-6 mb-3 form-floating mt-3 ml-auto gx-1">
<textarea class="form-control" id="note_content" style="height: 300px"></textarea>
<label for="note_content" class="form-label">Note content template (you can use book parameters here!)</label>
</div>
<div class="col-6 mb-3 form-floating mt-3 ml-auto gx-1">
<textarea class="form-control" id="note_content_preview" style="height: 300px" placeholder="preview" disabled></textarea>
<label for="note_content_preview" class="form-label">Note content preview</label>
</div>
</div>