• Skip to primary navigation
  • Skip to content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Twitter GitHub
You are here: Home / Archives for JavaScript

JavaScript


Warning! This is a draft, not a finalized post. See full draft disclosure.

WordPress JavaScript async defer

Last updated on February 11, 2019 by Sal Ferrarello

When loading JavaScript on a webpage with the “script” tag, there are additional attributes you can add to tell the browser how and when to load the JavaScript (‘async’ and ‘defer’). In WordPress, there is not a native way to add these attributes but this code snippet does the trick.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: HTML5, JavaScript, WordPress


Warning! This is a draft, not a finalized post. See full draft disclosure.

Introduction to Arrow functions

Last updated on December 17, 2018 by Sal Ferrarello

I’ve been spending more time working with modern JavaScript (including learning about arrow functions) and I wanted to make some notes here regarding arrow functions (since some details about them were not intuitive to me at first).

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript


Warning! This is a draft, not a finalized post. See full draft disclosure.

Why Learn jQuery

Last updated on December 17, 2018 by Sal Ferrarello

A friend of mine, who is not a developer by trade but deals with websites a lot, asked me recently about learning JavaScript. The short version of my recommendation is to learn jQuery. It is already installed on the sites he is working on and using it he can get results quickly.

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript, jQuery


Warning! This is a draft, not a finalized post. See full draft disclosure.

Detect when Native HTML5 Video Finishes Playing

Last updated on October 9, 2018 by Sal Ferrarello

On a recent project, I had to trigger a certain behavior when a native HTML5 video had completed playing (i.e. reached the end of the video, manually stopping it should not trigger the behavior).

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript


Warning! This is a draft, not a finalized post. See full draft disclosure.

JavaScript Idle Detection

Last updated on September 10, 2018 by Sal Ferrarello

Recently, I needed to determine when a website visitor was idle for a certain amount of time. I thought this was an interesting problem and wanted to spend a little more time with JavaScript so I wrote some code for it.

Filed Under: Computing, Draft, Programming Tagged With: JavaScript, website


Warning! This is a draft, not a finalized post. See full draft disclosure.

JavaScript Distance Between Two Locations

Last updated on July 19, 2018 by Sal Ferrarello

When working with locations in JavaScript, you often have two sets of latitude/longitude coordinates and you need the distance between theme. This function will give you an approximate distance between theme (in miles by default).

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript


Warning! This is a draft, not a finalized post. See full draft disclosure.

WordPress Development Overlay

Last updated on July 14, 2018 by Sal Ferrarello

When doing WordPress theme development I find it helpful to overlay an image of the approved design on top of the code I’m working on. I use a reduced opacity on the image so I can see the code I’m working on. This helps me match things like font size and spacing. I’ve been doing […]

Filed Under: Dev Tips, Draft, Solution Tagged With: JavaScript, WordPress Plugin, WordPress Theme

Technician sanitizing operating equipment

WordPress sanitize_title() in JavaScript

Last updated on August 29, 2017 by Sal Ferrarello

I was working on a project where I needed the functionality provided by the WordPress PHP function sanitize_title(). Unfortunately, I needed this functionality in JavaScript. As with many problems in programming, this turned out to be more complex than I originally thought it would be. I discovered there were a number of edge-cases that I […]

Filed Under: Computing, Programming, Solution Tagged With: JavaScript, WordPress, WordPress Plugin

A relay race runner's baton being handed from one person to another

wp_localize_script Explanation

Last updated on April 4, 2017 by Sal Ferrarello

A long time ago a WordPress programmer wanted to use a PHP value in their JavaScript. No problem they said, I’ll add this in my PHP theme code. Using a PHP Value in JavaScript – version 1 <?php $my_php_value = ‘Hello World’; echo ‘<script>’; echo ‘alert( “‘ . $myPHPValue . ‘” );’; echo ‘</script>’; ?> […]

Filed Under: Programming Tagged With: JavaScript, WordPress

How to Disable JavaScript in Chrome

Last updated on August 29, 2014 by Sal Ferrarello

2014-08-29 UPDATE: Current version of Chrome has issue I’m seeing an issue where the Disable JavaScript checkbox is becoming unchecked on refresh (thus undoing the point of this post). More info at https://code.google.com/p/chromium/issues/detail?id=369844 Current fix seems to be “click Disable JavaScript a bunch of times” (yes, I realize this is a ridiculous fix) How to […]

Filed Under: Computing, Dev Tips, Programming Tagged With: JavaScript

  • Page 1
  • Page 2
  • Next Page»

Copyright © 2019 · Genesis Framework · WordPress · Log in