Can i do that ?
var gender = $('.ImdbAddArtist').click(function() {
alert(this.id);
});
I use below code, but it s a little bit strange.
Can i have button’s ids from their name?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. Your code will work fine:
As long as the clicked element has an
idattribute, you will get an alert showing that value. If it doesn’t have anidattribute, you will get a blank alert.Here’s a working example.