
How to Check an Element Exists with and Without jQuery
Check whether an element exists with jQuery or vanilla JavaScript before running DOM code, avoiding null errors and fragile client‑side behaviour.
Articles
JavaScript is the working language behind most of my front‑end writing, from small browser behaviours to application state and asynchronous code. These articles favour the mechanism behind a feature over a clever trick, whether the subject is callbacks, async code, or a language edge that only becomes obvious in production.

Check whether an element exists with jQuery or vanilla JavaScript before running DOM code, avoiding null errors and fragile client‑side behaviour.

Opening a new browser window programmatically on‑click is very simple to achieve with jQuery, and no more complex to achieve with vanilla JavaScript too!

Use links for navigation and buttons for actions, preserving native focus and keyboard behaviour before adding custom click handlers or ARIA roles.

Choose between textContent and innerHTML safely, handle Internet Explorer's innerText fallback, and know exactly when untrusted HTML needs sanitisation.

removeEventListener() Needs the Same Function ReferenceUnderstand why removeEventListener needs the original callback reference, how anonymous functions differ, and what Internet Explorer required in 2010.