Hi there, I’m working on a Library App for TOP and I need some help.
I’m trying to add a toggle button inside a table that I created inside a JS function and I want to switch between ‘yes’ and ‘no’ every time the user clicks on it.
Right now it only works once and when I click the button a second time it won’t fire the event.
You are redeclaring the toggle variable every time the handler runs.
It’s also not “tied” to a specific book, so if you just make toggle a top-level variable you would lose the state on refresh. You would also get a bug where toggling one book would affect the toggle logic of another book. So you have to update the toggle state for each book’s data (i.e. the read yes/no value).