…Mostly a scene…
Today was a VERY long day. Thankfully, with a bit of help, I figured out my issue from yesterday. I was off by ONE lousy line of code.
Our next adventure was adding, creating, and manipulating things to the html (appendChild, etc.) I managed to figure out how to do all this, but I’m still fuzzy on how to get rid of a dynamically-created table, once it’s created. I know I can just put a blank string in the div that holds it, but that wipes out the table element within the div, which fixes it so you can’t repeat the selection process when you choose another category from the drop down. I carefully inspected the elements after the first table gets created, and it’s odd. The <tr> and <td> tags are created in the html AFTER the <table> <\table> grouping, so one can’t even erase out the table, as technically nothing is in there—even though a table is definitely created on the screen. The only way I see around this is to perhaps figure out a way to dynamically recreate the table element after the div is blanked out. Either that, or do a routine to specifically delete out the <tr> and <td> tags.
After 10:30 pm, I decided to call it a night and to tackle this again tomorrow. Right now, I have the lazy fix in there to just reload the page if you hit the “Start Over” button. I do need to figure out how to erase the rows correctly though, as the OTHER issue is that if you just keep selecting category options from the drop down, and don’t reset, the choices just get added over and over again to the page every time you select a category—they don’t get replaced with the new category’s table entries.
Knitting fair isle with five colors would be easier…