Hi, I have created an image-pool where people can upload their images for later use.
I got stuck on that part where people click on a image and it’s src-attribute would be inserted inside an input-tag. The problem is that I can’t figure out how to target them with “this” since the images are iterated in an {{each}}-iteration
<input type="text" id="choosenPic">
{{#each ImagesPool}}
<img class="placePic" src="http://localhost:3000{{_downloadRoute}}/{{_collectionName}}/{{_id}}/original/{{_id}}{{extensionWithDot}}" width="100px" max-height= "100px">
{{/each}}
I tried using an event like so:
'click .placePic'(event, template) {
var pic = template.$('.placePic').attr('src');
template.$("#choosenPic").val(pic)
//alert(pic);
},
But this only inserts the first image-src of the iteration inside the text-input.
I thought I could use it like this but it didn’t seem to work
var pic = this.$('.placePic').attr('src');
The error in this case is "this is not a function"
Any help would be appreciated!