Simple doubt in JS - imput to textarea

Asked

Viewed 31 times

-1

I have a question to know if I can continue a project I got ready but this with some problems.

the problem is that the whole project is returning to the values that are inserted into the HTML by the code <imput> and the imput in the question of Text is very limited and I would like to exchange for the option of <textarea> that works much better and has several possibilities.

Since I’m a layman at JS I’d still like to know if it’s possible to switch to the <textarea> since the whole JS process is referencing the <imput> for querySelector('tr:last-child imput') (this is just an example), would it be simple to change to textarea? It is possible to exchange for the textarea within the project and it continues to work the same since the 2 use only the inserted text ?

I thank from ja! vlw!

  • yes it is possible to use a textarea instead of an input

1 answer

1

The method querySelector() returns the first element that corresponds to a specified CSS selector(s) in the document. With this you could change the input for textarea hassle-free.

If the selector matches an ID in the document that is used multiple times (note that an "id" should be unique on a page and should not be used more than once), it returns the first corresponding element.

Example:

Get the first element <textarea> in the document:

document.querySelector("textarea");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.