Welcome to my blog !

How to retrieve x and y positions of html div elements javascript

August 10, 2022 ·  2 min read

How do get x and y-axis positions for any HTML element in javascript? Sometimes, We want to get x and y-axis coordinates for a given HTML element such as Div and img. How to get x and y positions of HTML div element Javascript provides DOM API to access the object. getBoundingClientRect() in javascript returns size of an element and position related to view port. Here is a Syntax DOMRect obj=object....

How to get the title of HTML webpage in javascript?

August 10, 2022 ·  2 min read

In this tutorial, learn how to get the current web HTML page title in javascript. And also how to update page title with value in javascript. On the Html page, the Title tag contains a text content of a complete web page. <title> tag in HTML contains text content. Here is a title example in HTML how to get the Current page title in javascript? There are several ways to get the current page title in javascript....

How to get Random value from an array in javascript

August 10, 2022 ·  2 min read

This example covers how to get a random number from an array of numbers in javascript. Let’s declare an array var array = [1,2,3,4] Here elements index starts from zero, and the end index is an array.length-1, i.e 1 Javascript random number from array example There are multiple ways we can do use Math.random() function Math.random()generates the random number between 0 and 1 and it is multipiled with array length and the number always returns between 0 to array length, This is called random Index....

How to get fragmented value from a url in JavaScript

August 10, 2022 ·  1 min read

Sometimes, We want to get the fragmented value after # symbole from an url in javascript For example, you have url abc.com/about#contact using javascript, get the value contact for a given url as given below. contact In HTML pages, Fragmented urls values can be used to navigate between different sections or tabs of a page. How to get fragmented url value in javascript There are multiple ways we can retrieve fragmented url values...

How to declare comments in HandlebarJS with examples?

August 10, 2022 ·  2 min read

In this tutorial, Learned about how to declare comments in handlebarJS template scripting language. Comments are text to describe line or code components. These are ignored by the compiler or interpreter in any programming language. Do handlebarJS support comments? Yes, It supports and uses to generate HTML content by the handlebar engine. Does it support inline-block and multiline comments? Inline comments are not supported but support single and multi-line comments....

You'll get a notification every time a post gets published here.