
JavaScript DOM Basics: Select, Change and Listen
A practical introduction to the JavaScript DOM: selecting elements, traversing the tree, changing content, creating nodes and handling events.
466 posts about JavaScript: questions with answers, tutorials and articles, newest first.

A practical introduction to the JavaScript DOM: selecting elements, traversing the tree, changing content, creating nodes and handling events.

Fetch search results from an API as the user types in a React select, using AsyncSelect, fetch, debouncing and request cancellation.

Create a reusable Axios instance with axios.create, use it safely in React with useEffect, and add interceptors and error handling.

Show thumbnails of several selected images before they reach the server, using object URLs or FileReader, with size and type checks.

Show an image preview from a file input with URL.createObjectURL or FileReader, validate type and size, and still check the file on the server.

Add a searchable dropdown to a React app with react-select. See the options format, controlled value, custom filtering and when to use AsyncSelect.

Set up Facebook Login with the JavaScript SDK and verify the access token on your server instead of trusting browser data.

Five kinds of search bar, each with modern accessible HTML and vanilla JavaScript. Learn when to use a simple, autocomplete, advanced, voice or predictive search.

Create a React app with Vite instead of the deprecated Create React App, then write a component, build it and deploy it.

npm is the default package manager for Node.js. Learn the core commands, package.json fields, version ranges, scripts and security basics.

The best ways to show PDFs on your own site, from a plain iframe to PDF.js and paid SDKs, with working code and security advice.

CommonJS, AMD, UMD and ES Modules compared with examples, plus how to mix ESM and CJS in Node.js and which format to choose today.

Build a Node.js web server using only the built-in http module, with routing, HTML and JSON responses and request body handling.

Show the current copyright year automatically with PHP date, JavaScript getFullYear or Node.js EJS, with notes for static sites and year ranges.
Show the current year in your footer without editing it each January. Covers PHP, JavaScript, year ranges and static site builds.

Add the CKEditor 5 rich text editor with the CDN or npm, submit its content with a form and keep it safe. CKEditor 4 is end of life since June 2023.
Step-by-step guide to adding a rich text editor with CKEditor 5 via CDN or npm, saving its content in a form, and keeping a legacy CKEditor 4 page working.

Set up a restricted API key, load the Maps JavaScript API, search places with Place.searchByText, and call the v1 REST endpoint from a server.

Replace the deprecated Google Sign-In platform.js code with Google Identity Services and verify the ID token server side.
Inline JavaScript lives in a script block or an event attribute. Learn when to use it, safer alternatives such as addEventListener, and how CSP nonces apply.