Tips & Tutorials – Javascript

6 Ways To Abort Javascript Execution – Simple Examples

Welcome to a tutorial on how to abort Javascript execution. Need to manually stop a piece of script for some reason? Client-side Javascript does not have a native abort function, but there are various alternatives to abort Javascript execution: In a function, simply return false or undefined. Manually throw new Error(“ERROR”) in a function. Set …

6 Ways To Abort Javascript Execution – Simple Examples Read More »

Simple Infinite Scroll with PURE Javascript – Free Download!

Welcome to a tutorial on how to create an infinite page scroll with vanilla Javascript. If you have been following up with social media – Facebook, Twitter, Instagram, etc… Then you should not be a stranger to that “scroll down to load more contents” interface. Yep, that is exactly what we will walk through in …

Simple Infinite Scroll with PURE Javascript – Free Download! Read More »

3 Ways To Include Javascript In HTML – Simple Examples

Welcome to a tutorial on how to include Javascript in HTML. So you have just started with Javascript and wondering how to properly “put Javascript” into an HTML file? There are 3 ways to include Javascript in HTML: External Javascript, load a Javascript file – <script src=”FILE.JS”></script> Internal Javascript, add a block of code in …

3 Ways To Include Javascript In HTML – Simple Examples Read More »

How To Crop Images In Javacsript (Simple Examples)

Welcome to a tutorial on how to crop images in Javascript. Want to lessen the server load by cropping the image on the client-side? Or just curious about how those “online image crop tools” work? To crop an image in Javascript: Create an image and canvas. var img = new Image(); var canvas = document.createElement(“canvas”); …

How To Crop Images In Javacsript (Simple Examples) Read More »

3 Steps To Resize Images In Javascript (Simple Examples)

Welcome to a quick tutorial and example of how to resize images in Javascript. Yes, resizing images is no longer a server-side thing. We can also do it in Javascript with just a few lines of code. We can use the canvas API to resize images in Javascript: Start by creating a new image and …

3 Steps To Resize Images In Javascript (Simple Examples) Read More »

Custom HTML Video Player With Playlist (Step-By-Step Example)

Welcome to a tutorial and example on how to create a custom video player with a playlist. Want to build your own video player and add a playlist to it? Sadly, things are not that straightforward. There are no native implementations of a video playlist in HTML and Javascript. The only way to create a …

Custom HTML Video Player With Playlist (Step-By-Step Example) Read More »

How To Read Files In Javascript (Simple Examples)

Welcome to a quick tutorial and examples of how to read files in Javascript. Yes, you read that right – It is possible to read files in client-side Javascript. To read a file in Javascript: Create an HTML file field – <input type=”file” id=”picker”/> Get the selected file – let selected = document.getElementById(“picker”).files[0]; Read the …

How To Read Files In Javascript (Simple Examples) Read More »