Stupid jQuery and CSS tricks: Move a hidden element to the end of the parent

I just came up with a solution so simple, yet so stupid, that I had to share it.

The scenario is this: my client has some third-party JavaScript to inject a form into a page. I’ve been writing some of my own CSS to style the forms, including some crafty use of :nth-of-type(2n) and :nth-of-type(2n-1) to apply styles conditionally to adjacent fields in a two-up layout. (These are just sequential <div> tags, and I have to work with what I’ve got.) Specifically, I’m adding some right margin on the “left” element, and no right margin on the “right” element.

I noticed an instance where my margins were flipped for two fields, and when inspecting the code, I discovered why: the client has set up their form with a hidden field tucked in there before the “left” element. That’s throwing off the value for 2n in my CSS. I was going to contact them and ask them to update their form to put the hidden element at the end, but I realized this is a problem that is likely to recur, so I should just write in a workaround. (Yeah, yeah. But it’s the lesser of two evils.)

Fortunately, the site is already using jQuery, so a fix was super simple. I’m leaving the CSS class names here as they are in the actual site, but you may need to change them to suit your particular form.

jQuery('.form_container .form_page .form_question.hidden').each(function() {
    jQuery(this).appendTo(jQuery(this).parent());
});

Since the hidden field has the .hidden CSS class, it’s really easy to use the jQuery .appendTo() method to just take all of the hidden fields and shove them to the end of the container element. I used the parent and ancestor CSS classes in my jQuery selector just to be sure I’m isolating this action to these particular forms. Then of course I have to tell the page when to execute this functionality, which is ideally on the load event:

jQuery(window).on('load', function() { /* Code goes here */ });

It works!

Happy 70th birthday to Geddy Lee of Rush!

I got seriously into Rush in late 1988, as a freshman in high school. But several years later — 2003, I think — when this 1984 tour film was finally released on DVD, I realized that I had seen it on TV (only once) circa 1985, presumably either on MTV or HBO, and had been completely enthralled with it as an 11-year-old. But since I never saw Rush again on TV, or heard them on the radio, I kind of forgot they existed until a friend (re)introduced me to them in high school, with a cassette tape of the then-new A Show of Hands concert album.

My jaw dropped the first time I watched this Grace Under Pressure Tour DVD, because I knew I had seen it before. Specifically, it was the video intro to “The Weapon” by Joe Flaherty as his SCTV vampire character “Count Floyd” that triggered the memory. Wow!

Geddy Lee was the reason I picked up the electric bass as a sophomore in high school. Happy birthday!

The curious case of my covid-induced loss of taste and smell

I’m writing this mainly for my own future reference, as I’m sure my memory of some of these details will vanish, much like my ability to smell onions has vanished this month.

I’m not sure how I (finally, after avoiding it successfully for 3 1/2 years) got covid. I know it’s more likely that I was exposed first, even though my wife tested positive several days before I did. It was probably the last weekend in June, when I subbed in a pit orchestra for a musical theater performance on Saturday, and then had a big band rehearsal on Sunday. I was in the presence of a lot of people over those two days, whereas my wife had not interacted with many people in the previous week.

On Monday I had an achy, fitful, mostly sleepless night, and was feeling run down for most of Tuesday morning, but by afternoon I was fine, and thought no more of it. Then on Thursday night, my wife got knocked out with a sudden fever and fatigue that we foolishly did not assume was covid, but the next morning she tested, and it was positive. She started isolating, but we both knew it was probably too late.

Although I felt totally fine, I started testing daily and was repeatedly negative. But that Sunday night I once again was achy and fitful, this time with chills added to the mix. I thought for sure I must have covid, but I still tested negative the next morning. On Tuesday I finally did test positive, even though — other than those two random nights, six nights apart — all I was feeling were the mildest imaginable cold symptoms. Those lingered for about a week, and that was pretty much it.

Except.

I believe it was that Thursday or Friday, a few days after I first tested positive, and was mostly already feeling fine again, that I noticed that most distinctive and curious of covid symptoms beginning to appear: I was rapidly losing my sense of taste and smell.

Mostly smell, honestly, but of course the two senses are linked. I noticed initially that I basically couldn’t smell anything, but I hadn’t completely lost my sense of taste. Sweet and sour were both maybe around 30% of their normal levels, and bitter (hurrah) was pretty much entirely unaffected. (Salty and umami were, for the moment, gone.)

It has now been over two weeks since I noticed the problem, and to some extent my senses have returned. I can now smell some things, and I can taste pretty much everything. But I am realizing that the loss has been very selective. In particular, I can smell many mild scents almost as normal, but strong odors, like raw onions, are almost completely undetectable.

Put it this way: I am the type of person whose eyes normally burn painfully and water copiously when cutting raw onions. But last week I cut an onion in half, put it right up to my nose, and inhaled as deeply as I could, and… well, there was an ever-so-slight suggestion of “onion.” But not only could I not smell it at all if it was more than a millimeter from my face, but I didn’t get any of the eye watering, either. My sensation of that particular volatile compound is just totally dead.

My sense of taste has fared better, as I can now pretty much taste everything — again, except onions — but I’ve noticed that certain things don’t taste like they’re “supposed” to, or that the tastes I perceive are only vague and indistinct. I can tell I’m tasting something, but I’m not sure what it is.

I think that comes back to the deadening of the “volatile compounds” sensation. It’s the complex flavors made from combinations of ingredients that are being affected. I’m only getting the broad strokes. Indian curries still taste good to me, but all the nuances of the layered spices are missing.

Which takes me back to about 10 days ago, when I first noticed there was one thing I could taste fully, just as it has always tasted to me.

Ketchup.

I guess ketchup is essentially a fairly simple blend of sweet and acidic, without much nuance. (That’s probably why kids like it.) And since those senses never totally went away, it’s not surprising that would be something I could taste fully. For a few days, I put a lot of ketchup on most of the things I ate.

I haven’t spent a lot of time investigating other people’s stories of their covid experiences, but I’m wondering if most people who reported loss of taste and smell had this kind of “selective” loss the way I did. I assume that’s the case. And then, of course, I wonder why covid causes this loss of sensation of, most specifically, the kinds of odors that are more or less nature’s warning bells for things that are possibly dangerous to consume or be exposed to. It’s not like covid has a “plan,” but I wonder if this particular symptom has manifested because it gives covid some kind of environmental advantage that helps it spread, or if it’s just a random quirk, a side effect of the chaotic nature of viral mutation and evolution.

Anyway… I am thankful for the vaccines, which I am sure contributed to how mild my case of covid was, and probably prevented me from catching it at all before July 2023. And I’m thankful that other than a couple of bad sleeps, my symptoms were extremely tolerable. This smell/taste thing has been, more than anything, a curiosity to observe and study. But it is starting to get a bit old, so I’m hoping my senses fully return sooner rather than later.

I do realize of course that, although I think it’s unlikely, the loss may be permanent or semi-permanent. And so there, too, I am thankful that I have not completely lost these senses, because I can certainly live with things the way they are. I just might die early from eating something that’s gone rancid and I couldn’t tell. Ç’est la vie.


Update: Of course, after writing this, I did research the matter a bit, and it affirmed that I should never do that. I hadn’t considered, until now, that I am on a journey of recovery of these senses, and that possibly, months from now, I will enter a stage where I do regain my sense of smell, but everything will be distorted and unpleasant. Ugh. On a more helpful note, that Scientific American article does talk specifically about chemical sensing, which is different from sense of smell. This seems to be the essence of my loss; I could not sense the minty freshness of toothpaste at all for a few days. That is starting to come back, as well as my ability to sense hot peppers.

Using your Mac with your iPhone hotspot? Be sure to turn on low data mode!

In the summer, I like to take my MacBook Pro with me and work outdoors. Doing that is entirely dependent upon my T-Mobile hotspot on my iPhone. I had my account maxed out at 16 GB of hotspot data per month, so imagine my surprise today when — one day into a new cycle — I got a notification text that my data had been used up!

I’m still not sure what exactly my Mac was doing, presumably some kind of background iCloud Drive backup, but I managed to use up an entire month’s allotment of bandwidth in extremely short order. I worked with T-Mobile support to get my account bumped up to the absolute maximum 20 GB, but there’s no certain explanation of what it was that used all of that data.

But along the way I discovered the Mac does let you configure “low data mode” specific to each network you connect to. If you find yourself needing to use a hotspot regularly, I would strongly recommend turning on low data mode for that network. To do that with the new Ventura System Settings app, go to WiFi, then under Known Networks click the icon for your hotspot, and chose Network Settings…

Now here’s where it gets interesting. I turned on the Low data mode toggle about five times and it kept, after a couple of seconds, shutting itself back off. Finally it “stuck.” Now we’ll see over the coming days if it actually makes a difference!

On the Supreme Court, the First Amendment, websites and wedding cakes

From the perspective of someone who supports LGBTQ+ rights, I am not exactly a fan of this recent SCOTUS decision. Simultaneously, as a web designer/developer, I think it is extremely important to recognize the difference between this type of work and a more commodity-oriented business.

Web design and development is creative work, requiring a personal input of time and energy, thought and consideration. It’s not a public storefront, selling premade goods. It’s not even a construction or contractor type job, where you may have disagreements with the client’s worldview, but the work itself is (generally) philosophically and politically neutral.

As a web designer/developer, I absolutely choose which types of projects I do or don’t want to work on, and I insist on maintaining the right to refuse to take on a project whose mission or purpose does not align with my values.

To put a finer point on it: I think it’s worth distinguishing between a web designer who is actively collaborating with their client to build something custom for them, vs. a DIY-type system where the client is provided with tools to build a site for themselves. In other words, for the type of work I do in client services, I should have the right to refuse to participate in a project whose purpose I disagree with. But if I were, for instance, Squarespace, selling access to a service I built, which lets users create their own sites, then I should not have the right to decide who can or can’t use the service. (As long as what they’re doing with it is legal.)

I can get even more specific to my own situation here. In addition to my client services, I also sell a product: a WordPress plugin for integrating calendars (e.g. Google Calendar, Office 365, etc.) into your website. I do not, and I strongly believe should not, decide which types of sites are allowed to use my plugin. I know there are customers of the plugin whose businesses/organizations do things I do not particularly agree with. But there I am selling a finished product — a commodity. Anyone who wants to buy it (again, as long as they’re not doing something illegal — although I won’t even know that, unless I specifically take the time to investigate them, post-sale) is welcome to do so. But if those same people approached me in my client services role to help them build their website itself, I would/should have the right to turn down the project if I didn’t want to do it.

Of course, there’s another layer to this: Why did this even become a court case? As I understand it, the designer here is the plaintiff, and doesn’t actually run a wedding website business yet. She is clearly doing this to make a political statement. I’m not sure how much the Colorado law was really pushed on her, or if it even technically applies to her (hypothetical) business. For me, and I think a lot of other people in my shoes, it’s a simple enough practical matter to turn down projects you don’t want to work on — regardless of why you don’t want to work on them. As a creative worker, you are essentially selling your time, not a commodity, and you have a limited supply. It’s a simple matter of being “too busy” to take on the project. There may be laws saying a business can’t discriminate, but surely there cannot be any laws that say a business has to work more hours than humanly possible.

So, what’s the upshot here? Well, it kind of seems like this case isn’t really about the First Amendment rights of business owners like me at all, because I’m skeptical that those were ever really under any threat. But it definitely opens the floodgates for business of all types — including those that truly are “open to the public” and selling commodity goods — to discriminate against potential LGBTQ+ customers. And that’s why I’m opposed to the current SCOTUS super-majority: their aggressive efforts at rolling back civil rights. That’s what this case is really about.