I want to execute function when button is clicked. Button is created using append() function.
I've tried using on but it is not working.
I trying to achieve zoom functionality. I've modified imgages-grid.js file in library. link of the library : https://github.com/taras-d/images-grid#images-grid
Here is the code I modified in file images-grid.js file :
ImagesGridModal.prototype.renderModal = function() {
this.$modal = $('<div>', {
class: 'imgs-grid-modal'
}).append(
$('<div>', {
class: 'zoom-btn'
}).append(
$('<button id="ttt">', {
class: 'zoom'
}).append("+")
).append(
$('<button>', {
}).append("-")
)
).appendTo('body');
}
And in another js file I am writing function for zoom in and out Right now I am just trying to print normal console.log("Executed");
Here is the code :
$("#ttt").on("click", function() {
console.log("Executed");
});
What I want when + button is clicked image size should increase & when - is clicked it should decrease.