How to select name attributes of dynamically generated elements in jquery
I have a forum page with dynamically generated reply buttons to reply to comments. Since i cannot use an id for multiple elements, i gave each button a name attribute with the value being the id of the particular comment been replied . How do i select these buttons using jquery?
This is what i've been trying but has been throwing up syntax uncaught errors:
$(document).on('click', 'button[name='+postId+']', function(e){
e.preventDefault();
alert("it worked!");
});