S
S
Sergey2018-03-26 20:43:19
css
Sergey, 2018-03-26 20:43:19

How to add text from button to input?

Hello!
There is such an input - <input type="text" name="tag" value=" Your tag">
How to make it like on a gif?
That is, there are buttons with genres under the input and when you click on these buttons, they will be added to the input where the tags are.
(the tags themselves are not needed, you need to add the text to the input itself)
I will be very grateful for the ready-made solution, thanks in advance;)
5ab930fa980d7015240558.gif

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Shcherbakov, 2018-03-26
Dobryak @sergey_dobryak

<button onclick="document.getElementsByName('tag')[0].value += 'Text';">Add 'Text'</button>

This is the easiest option

P
pantsarny, 2018-03-26
@pantsarny

google://jquery+input+tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question