I am using the addEventListener event on one of the buttons in MVC datatable. (I am using that button to Show image in popup corresponding to that row).
So when I clicked on that button in first row in datatable, it works fine. But as I go to the same button on a diferent row, it does not do anything.
Maybe multiple addEventListener is not working.
So need help in this.
Kindly Thank you in advance.
Following is code snippet :
- document.getElementById("buttonopenimage").addEventListener("click", ShowSnapOnHistory,false);
- function ShowSnapOnHistory()
- {
- alert($("#hdnFlag").val());
- $.ajax({
- url: '@Url.Action("ShowReceiptImageInPopup", "Transaction")',
- type: 'GET',
- data: { Id: $("#hdnFlag").val() },
- dataType: 'json',
- success: function (result) {
- var image = new Image();
- image.src = 'https://api.shoppercoin.io/UploadedFiles/' + result.reclist.ReceiptName;
-
- var viewer = new Viewer(image,
- {
- hidden: function () {
- viewer.destroy();
- },
- });
-
- viewer.show();
- }
- });
- }