Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find id of selected submit button

I have 2 input field and also 2 submit button that are hidden and i am using jquery to submit input field when enter is pressed,so i want to find that when enter is pressed it display selected button id i have done it in jquery bt it dont show me any id here is example on jsfiddle

$('input').click(function() {
    var id=$(this).attr('id');
        alert(id);  
});

this shows me all the id but i one only selected http://jsfiddle.net/azamalvi/kD3bx/7/


1 Answers

$('input').click(function(eventObject) {
     var idOfButtonClicked = $(eventObject.target).attr('id');
});
like image 155
Brad M Avatar answered Feb 01 '26 09:02

Brad M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!