if I use:
<a class="btn btn-primary someClassName">Test</>
$(document).ready(function () {
$("document").on("click", '.someClassName', function () {
alert('click');
});
});
If I click the link, it doesn't do anything.
However, if I change it to:
<a class="btn btn-primary someClassName">Test</>
$(body).ready(function () {
$("document").on("click", '.someClassName', function () {
alert('click');
});
});
Then the alert is displayed.
So my question is: why does $("document").on()
not work, and why does $("body").on()
work?