I have a couple of images that can be clicked on.
When click on an image I should add a name to a text field.
So in this example, an image of mickey mouse, the name of the image is "Mickey Mouse", this name should be in the text field.
With my code the whole image string is in the text box.
This is the image
<a onClick="insertText(this)"
href="#pagetwo"
data-transition="slide">
<img src="images/mickey.png"
name="Mickey Mouse"
width="114"
height="114">
</a>
The function to write to the text field:
function insertText(txt) {
document.getElementById('disney').value = txt.innerHTML;
}
The form field:
<label for="name">Melding:</label>
<input type="text" name="disneyfigure"
id="disney" readonly
value="<hier komt automatisch disney figuur>">