javascript - Delegated event handler is working more than once for same class -


i having problem delegated event used click function, have 4 images different id same class 'edit_agent_val', when click on image function runs 4 times instead of once.

here code have used: sure take @ images working with:

<img id="treegrid-1" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="pessimist"> <img id="treegrid-2" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="naugahyde"> <img id="treegrid-3" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="lemma"> <img id="treegrid-4" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="rackoz"> 

and here function runs 4 times instead of once:

jquery(document).ready(function($) {      $(document).on('click', '.edit_agent_val', function() {              alert("sdsdsd");      }); }); 


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -