P
P
Polina2020-05-24 17:56:04
JavaScript
Polina, 2020-05-24 17:56:04

How not to lose focus from a textarea form when inserting through an element select in another select form?

There is a form in which you can edit the text, and there is a select form (drop-down list), when you click on the elements of which these elements are inserted into the text editing form. The question is how not to lose focus from the text editing form when clicking on the drop-down list? If you can recommend articles on this topic, I would be grateful :) (I only found about operations with one form, and not when there are several of them)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Pautov, 2020-05-24
@bootd

Just when the select value changes, focus the textarea again

document.querySelector('select').addEventListener('change', () => {
  document.querySelector('textarea').focus()
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question