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

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -