Page Speed Optimization, WordPress Plugins & Tutorials Methods, Events and Scopes Archives - getButterfly

Currently browsing Methods, Events and Scopes

Tuesday, August 9, 2022

Code Golfing Tips & Tricks: How to Minify your JavaScript Code

If you are into JavaScript code golfing or just looking to minify your code, here’s a collection of tips and…

Tuesday, August 9, 2022

The Complete JavaScript Strings Reference

JavaScript strings are deceptively complex constructs. There are actually two different types of strings – string Literals and string Objects…

Monday, July 4, 2022

JavaScript Form Validation

This JavaScript code snippet adds inline validation to any form field (input, select and textarea). Feel free to customise it…

Tuesday, May 17, 2022

How to Optimize a Theoretical Funnel Page Load Speed

Here’s a quick snippet to preload the next step in a theoretical funnel/workflow: PHP JavaScript

Friday, June 3, 2022

Numerical Integration Using JavaScript

This is a quick reminder on how to use mathematical functions inside JavaScript. Instructions Use * to indicate multiplication: Type…

Tuesday, May 17, 2022

Random JavaScript Tutorials

I needed some structural updates for a site, and among them, I added some JavaScript snippets. I will show you…

Friday, June 3, 2022

How to declare a global variable inside a jQuery function

A JavaScript global variable is a variable with global scope, meaning that it is visible and accessible throughout the program, unless…

Friday, June 3, 2022

How to execute code for X visits

This JavaScript will let you execute code a certain number of times. For example, you might want to only show…

Friday, June 3, 2022

JavaScript shortcuts for TRUE and FALSE

Here’s a neat trick if you’re into micro-optimization. JavaScript compressors and minifiers are used to make JavaScript code smaller and,…

Monday, May 16, 2022

🍪 How to Expire localStorage Items and Replace Cookies

I don’t use 🍪 cookies anymore, I think they are too… rigid. I use localStorage items. By default, they don’t…

Monday, May 16, 2022

How to extract a value from an element and, optionally, round it

This JavaScript snippet will extract a price from a DOM element, remove all alphanumeric characters, such as currency or symbols…

Tuesday, May 17, 2022

How to create a YouTube video cover using the YouTube Iframe API

There’s an increasing trend of adding full-width (possibly full-height) YouTube video covers with autoplay. Using the YouTube Iframe API, this…