How do I copy the value of the department from the dropdown to the text area once I select it?
For example if I select IT department I want it to appear in comment text area like "IT Department:"...comment ...
Sorry I'm newbie for coding and I want to learn how to do it
Asked
Active
Viewed 117 times
1

Bakhodir Ibragimov
- 35
- 3
-
Would you mind showing us your code? While images help to some extent, they are hard to grasp for screen readers and visually impaired contributors. And without code, we cannot reproduce your issue. – Marco Oct 10 '22 at 07:27
-
Share your code, it will be easier to try and help you. – Yanay Oct 10 '22 at 07:29
1 Answers
1
Yeah, you can do with this DOM
const eleId = document.getElementById("dropdown");
const textArea = document.getElementById("text");
eleId.addEventListener("change", function() {
textArea.innerHTML = this.value;
})
<select id="dropdown">
<option value="IT depart">IT depart</option>
<option value="CS depart">CS Depart</option>
<option value="BBA depart">BBA Depart</option>
</select>
<textarea id="text">
</textarea>

Ahmad Faraz
- 1,371
- 1
- 4
- 11