I'm using the following code to detect when a dynamically generated button is clicked.
$(document).on("click",".appDetails", function () {
alert("test");
});
Normally, if you just did $('.appDetails').click()
you could use $(this)
to get the element that was clicked on. How would I accomplish this with the above code?
For instance:
$(document).on("click",".appDetails", function () {
var clickedBtnID = ??????
alert('you clicked on button #' + clickedBtnID);
});
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…