Software Engineering in WordPress, PHP, and Backend Development

Tag: jQuery (Page 1 of 2)

The Why and How of Custom jQuery Events

As far back as 1.0, jQuery has provided a trigger function that allows us to:

Execute all handlers and behaviors attached to the matched elements for the given event type.

But it wasn’t until 1.3 that this particular function became significantly more useful, at least as far as I’m concerned. I say that because that’s when we gained the ability to define custom events and then set handlers for them.

Custom jQuery Events

What, though, is a likely use case in which custom jQuery events are useful in the context of WordPress? Off the top of your head, you may be able to come up with many. Or maybe not.

It hasn’t been until lately that I’ve been using them significantly more than usual. So I thought I’d share how I’m using them if for now other reason than showing you how to wire them up to your work.

Continue reading

Is It Really Worth Debating jQuery Versus ES6?

When building WordPress plugins for myself or others, several of the things I take into account – as we all should – is the level of maintainability, scalability, and support for the plugin as WordPress continues to move forward.

Specifically, I’m talking about client-side development (or, more simply, JavaScript).

As the support for ES6 continues to rise, jQuery continues to move forward with development, and the desire to use new APIs to build out our solutions, I believe it’s worth asking the question:

Do we really need to stick with jQuery?

Continue reading

A Quick Tip for Hiding Browser Extension Overlays

In my experience, most browser extension overlays use a background with the type of data:image/svg+xml. Furthermore, each of these overlays uses inline styles (rather than external stylesheets) to render their buttons (or whatever controls they are opting to render).

Hiding Browser Extension Overlays

This means we can use some JavaScript techniques to find elements with that have these attributes and then toggle their visibility.

But first, why would we care even to hide them?

Continue reading

When Is jQuery’s Clone Function Useful?

One of the challenges of learning a library (be it the standard library of functions that come with a programming language or a third-party project) is two-fold:

  1. learning the functions that are available,
  2. learning how to use said functions.

And, really, sometimes even learning how to use said functions isn’t all that hard – it’s knowing when to use a given function to help minimize code while still achieving the goals of the project.

Continue reading

Timedropper – A jQuery Time Plugin

There’s some programmer joke that says there are two things hard in computer science: naming things and time zones. On second thought, maybe that’s not the joke at all (because it sounds too true to be funny).

Whatever. The point of this post isn’t to try to make jokes, but to share something useful for working with time zones in the context of JavaScript.

Specifically, I’m talking about Timedropper. It’s a cool jQuery time plugin designed to make it easy for you to implement options into your web application that gives users an intuitive way to work with time.

Continue reading

« Older posts

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑