How do you reference a button by 'this' and pass it into a function?
$(document).on("click", ".join-group-btn", function () {
var groupid=$(this).val();
var button=$(this);
joinGroup(groupid, button);
});
Then I keep the joinGroup function in my library on a separate page:
function joinGroup (groupid, buttonIn) {
var button = $(buttonIn);
var l = Ladda.create(document.querySelector(buttonIn));
}
Id's won't work as the buttons are generated dynamically.
This throws:
Dom exception 12: An invalid or illegal string was specified
Thanks for the help! It is greatly appreciated.