Clicking on the img element does not work to call a JS function, what am I doing wrong?
Follow the code below:
HTML:
<label class="control-label">Select File</label>
<input id="input-id" type="file" class="file">
JS:
$("#input-id").fileinput({
showZoom: true,
zoomIcon: false
});
//Tentativa 1
$("img[class='kv-preview-data file-preview-image']").on('click', function() {
alert('addMore click event');
});
//Tentativa 2
$("img[class='kv-preview-data file-preview-image']").click(function() {
alert( "Handler for .click() called." );
});
//Tentativa 3
$(document).ready(function() {
$("img[class='kv-preview-data file-preview-image']").click(function () {
alert("Hello!");
});
});
//Tentativa 4
$(".kv-file-content").on('click', function() {
alert('addMore click event');
});
None of the 4 attempts do not work. Here's an example JSFIDDLE .
Here's the image to click on:
Any solution?