I found a few posts on the topic, but none of them worked for me. The only thing I found that seemed like it would help was this:
$._data($("#qRemBtnX"), "events");
, where qRemBtnX is the ID of the remove button for question X. But this just returned undefined for any of the buttons, even before I removed any.
I have a form that allows for input fields to be added and removed. Each input field is wrapped in a div that also contains a button to remove that question. Each div has a unique ID and each removal button also has a unique ID.
When I remove a question, I need the fields following that one to replace each preceding input. So if I have, say 4 input fields wrapped in a div with a button, and these buttons are #btn1, #btn2, #btn3, #btn4, and I remove the div containing #btn, I need to rename #btn3 to #btn2, and #btn4 to #btn3, as well as transfer the event listeners for them.
I expected this to rebind existing click listeners with the new buttons since the click listeners were added by using an ID selector. That wasn't the case however. So is there any way that I can just take an existing event listener and rebind it once I update the ID's of the buttons?