Currently browsing JavaScript
Tuesday, May 10, 2022
Giving Object Context to Function Calls
JavaScript has a dynamic object named this. By default, this equals to the global object container, so if we have…
Tuesday, April 29, 2025
Self Documenting Flexible Parameters
When managing function parameters, it’s often more maintainable to use an options object. This allows you to pass a single…
Tuesday, May 10, 2022
Use ‘this’ Keyword with setTimeout()
setTimeout() is a great help to many JavaScript developers. For example, you may wish to add a delay to allow…
Tuesday, May 10, 2022
Load a JavaScript File on the Fly
Similar to my previous article on how to add/inject a CSS stylesheet using Vanilla JavaScript, this is how you load…
Monday, September 22, 2025
Generate HTML List From JavaScript Array
Generate an HTML list based on the contents of a JavaScript array. By modifying the makeList() function to accept parameters…
Tuesday, May 10, 2022
Same-Origin AJAX Request Using Vanilla JavaScript
This JavaScript function will send an AJAX request - GET or POST - with no third-party dependencies. I find it…
Tuesday, May 10, 2022
How to Add a CSS Stylesheet in Vanilla JavaScript
The function below will dynamically inject a CSS stylesheet in the document's using Vanilla JavaScript (no dependencies).
Wednesday, April 30, 2025
How to Make an Iframe Responsive Using JavaScript
Stubborn iframes can be tamed using a simple JavaScript trick and a couple of code tweaks. Use the code below…
Tuesday, August 22, 2023
Pure JavaScript tabbing functionality with linkable tabs
This script shows you how to create vanilla JavaScript tabs anywhere, physically linkable without any external JavaScript library. 305 bytes…
Wednesday, April 30, 2025
How to dynamically append a CSS file
This code snippet allows you to dynamically append a CSS file to your document's head. It can be used inside…
Wednesday, April 30, 2025
JavaScript String Multiline Trim/Cleanup
This small JavaScript prototypes enhance the trim() function and allow for better trimming and/or replacing line breaks with commas (or…
Wednesday, April 30, 2025
JavaScript Credit Card Validation
This is a collection of JavaScript snippets to validate credit card details without requiring any library. Feel free to customise…
Tuesday, May 17, 2022
How to Open a JavaScript Centered Popup Window
This tutorial is about JavaScript popups and how to show a window in the center of the screen and focus on it.…