Tips & Tutorials

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 »

Set & Get HTML Data Attributes In Javascript (Simple Examples)

Welcome to a quick tutorial on how to set and get HTML data attributes in Javascript. Want to insert your own custom property or data into HTML elements? To set data attributes in HTML, we define data-KEY=”VALUE” in the start tag. E.G. <div data-color=”red”> To set data attributes in Javascript, we set the dataset property.

Set & Get HTML Data Attributes In Javascript (Simple Examples) Read More »