Day 23: Dynamically creating things…

…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…

Day 22: Lost in the DOM…

Day 22: Lost in the DOM…

This was just one of those days. It began well enough…I was understanding everything, and the first exercises went well. Then the **** hit the fan. I do realize that a huge part of what we do concerns interacting with the browser and the DOM; but I swear, at times I really miss our beginning labs, when all we did was code and run in the Code Runner console. The worst dread on earth is when you try to run your code, NOTHING HAPPENS, and then you have to hit F12 in the browser. Whenever I see that dreadful flaming red type, flashing angry error messages across the console, I always want to scream at the top of my lungs, “Dear God, WHAT FRESH HELL IS THIS???” Then I remember that I’m old enough have parented the vast majority of my fellow students, and that it would probably be undignified to cry and throw things.

Today, I spent a good part of the afternoon with the bloody F12 console. We’re doing some god-awful routine where we have to take a substr of similar <img> ids (image1, image2, image3) to get the numbers on the ends (1, 2, 3). Then we have to concatenate the “para” part of the paragraph <p> ids (para1, para2, para3) to these like some nightmare from Frankenstein, and — I’m not making this up — take the alt attributes of the img tags and shove that alt text into the <p> html.

I think it was after the 12th time I tried to make this work that I decided I really needed to knit…

I know…all the ghastly code is going to be waiting for me in the morning. On the other hand, I got a mental health break, and my little intarsia sheep are really coming along!

Day 18: My life on the “outside”…

…or, WHAT LIFE? Note: whining ahead.

After yet another day of staying very late, trying to figure out code (and desperately trying to remember what I learned last week, that I’m evidentially supposed to be incorporating into the exercise du jour), I’ve come to the conclusion that I really can’t make plans after class during the week. I have a whole plethora of activities that I usually do after work that are just not going to be possible anymore—at least not until I finish training.

So far, this week, I’ve had to blow off my Tuesday night knitting group (sacrilege!) and another activity I do on Wednesday afternoons. We have some friends visiting tomorrow night, whom I’m probably going to wave “hello” to on my way into my home study to do more work (my classwork portfolio is a tad out of date). Oh, and we’re having SEVERAL people to the house this weekend—something we’d planned long before I knew I was going to be spending my summer snorkeling through CSS, HTML, JavaScript, and Bootstrap. Ask me if I’ve done ANYTHING to prepare for this…so far, my poor, long-suffering spouse is having the shoulder the burden for this.

Don’t even ask me about my exercise schedule…okay, you may ask. This was the extent of my exercising for today. At lunch, I enough time to walk outside and take a picture of this bird…that’s it.