How to Detect Browser Window is Active or not – JavaScript

Sometimes you may want to take more control over your user Browser when he/she opens your website in a Browser Window.

For example – you want to know when the user closes the Browser Tab and execute your code.

If you want to know how much time the user active on your website, in this case, you can use JavaScript. Using that you only enabled the timer when the user is an active tab on your website.

Or you want to run the Animation only when the user is active otherwise stop it.

This kind of functionality you have seen on websites or PTC sites that provide ads viewing to the users. They only count the ads view when the user is active on their website until a given time otherwise they cancel the view after the specific time.

In this tutorial, I show how you can use JavaScript to detect whether Browser Tab Window is active or not.

How to Detect Browser Window is Active or not - JavaScript

Read more

Deleting Values from JavaScript Arrays: Methods and Examples

In JavaScript, dele­ting values from an array is a common task. There may be­ various scenarios where the­ removal of specific values be­comes necessary within a program. Fortunate­ly, JavaScript provides several built-in functions spe­cifically designed to efficie­ntly handle such situations.

When it comes to deleting values from an array, some of these inbuilt functions automatically rearrange the array index after deletion, while others solely remove the value without reordering the index. Understanding and utilizing these functions appropriately can significantly enhance your JavaScript coding skills.

In this tutorial, I will show you how to use these functions to efficiently delete values from an array, while maintaining the array’s integrity.

Let’s delve into JavaScript and learn how to delete values from an array using inbuilt functions.

Deleting Values from JavaScript Arrays: Methods and Examples

 

Read more

How to make Editable Div Element with contentEditable Attribute

Did you ever thought to make an editable div element or <p>, <span>, etc. that works the same as a Text field and Textarea.

Some websites allow the user to edit their content by just pointing to the content and start to update it.

You will already know that <div> is a read-only container that means you can’t edit the content inside of it.

In this tutorial, I show how you can do this with the contentEditable attribute.

How to make Editable Div Element with contentEditable Attribute

Read more