Y
Y
yischyk2019-11-02 10:46:01
Images
yischyk, 2019-11-02 10:46:01

How to add text to input when clicking on an image?

How can I make it so that when I click on any image, the text is written to the input? Thanks, I'm just not very good at js.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yischyk, 2019-11-02
@yischyk

Found a solution

<html>
<head>
<script type="text/javascript">
function insertSmile(smile)
{
document.chatform.chatmassage.value += smile;
}
</script>
</head>
<body>
<form method="POST" name="chatform">
<textarea name="chatmassage"></textarea>
</form>
<img src="../chat/smile/smile.gif" alt=";)" onclick="insertSmile(';) ')" />
<img src="https://vk.com/emoji/s/sprite_0.png" alt="%)" onclick="insertSmile('%) ')" />
</body>
</html>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question