javascript - jQuery: get clicked button values -


i need values of jquery button when form submitted. form , jquery i'm using below, it's not working.

i need value of data-url.

jquery code

$("#addagency").submit(function(event) {         var val = $("button[type=submit][clicked=true]").attr('data-url');     alert(val); }); 

html code

<form id="addagency">     <button type="submit" data-url="test.php"> </form> 

thanks in advance.

try

$("#addagency").submit(function(event) {         var val = $(this).find("button[type=submit]").data('url');     alert(val); }); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -