Lokesh Badavath

Lokesh Badavath

67 Articles Published

Articles by Lokesh Badavath

Page 4 of 7

Adding an element at a given position of the array in Javascript

Lokesh Badavath
Lokesh Badavath
Updated on 21-Nov-2022 592 Views

In this article, we are going to learn how to add an element at a given position of the array in JavaScript. An array is a special variable, which can hold more than one value. An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items together. This makes it easier to calculate the position of each element by simply adding an offset to a base value of the memory location of the first element of the array. The base value is index 0 for the first element in the array and ...

Read More

Adding an element at the start of the array in Javascript

Lokesh Badavath
Lokesh Badavath
Updated on 21-Nov-2022 424 Views

In this article, we are going to learn how to add an element at the start of the array in JavaScript. An array is a special variable, which can hold more than one value sequentially. It is a collection of items stored at contiguous memory locations. The idea is to store multiple items together. This makes it easier to calculate the position of each element by simply adding an offset to a base value of the memory location of the first element of the array. The base value is index 0 for the first element in the array and the ...

Read More

How to get the body's content of an iframe in JavaScript?

Lokesh Badavath
Lokesh Badavath
Updated on 21-Nov-2022 24K+ Views

We use getIframeContent(frameId), to get the object reference of an iframe in JavaScript. To get the element in an iframe, first we need access the element inside the JavaScript using the document.getElementById() method by passing iframe id as an argument. Using iframetag The tag in HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. The element is supported in every browser like (Google Chrome, Microsoft edge/ internet explorer, Firefox, safari, and opera). We are using srcdoc attribute in tag to specify the HTML content of ...

Read More

How to understand JavaScript module pattern?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 316 Views

In this article we are going to learn how to understand JavaScript module pattern. The Module pattern is used to copy the concept of classes, so that we can store both public and private methods and variables inside a single object. Since JavaScript doesn’t support classes, similar to classes that are used in other programming languages like Java or Python. Why use modules? Maintainability − A module is self-contained and aims to lessen the dependencies, so that it can grow and improve independently. Name spacing − In JavaScript, variables outside the scope of a top-level function are global. Because ...

Read More

How to iterate a JavaScript object's properties using jQuery?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 2K+ Views

In this article, we are going to learn how to iterate a JavaScript object’s properties using jQuery. The simplest way to iterate over an object with JavaScript is to use a for in loop. The for statement will iterate over the objects as an array, but the loop will send the key to the object instead of an index as a parameter. This loop is used to iterate over all non-Symbol iterative properties of an object. The hasOwnProperty() method can be used to check if the property belongs to the object itself. The value of each key of the ...

Read More

How to work with JavaScript Drag and drop for touch devices?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 5K+ Views

In this article, we are going to discuss how to work with JavaScript Drag and drop for touch devices in JavaScript. Using JavaScript, we can only drag an image and some text. To drag an image, we simply hold the mouse button down and then move it. To drag the text, we need to highlight some text and drag it in the same way as image. HTML5 specifies almost all elements can be draggable. To make an element draggable, we add the draggable property with the value of true to its HTML element tag. Syntax Following is the syntax ...

Read More

How to secretly copy to clipboard JavaScript function in Chrome and Firefox?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 1K+ Views

In this article we are going to try how to secretly copy a JavaScript function to the clipboard. We use the copytext() method to secretly copy JavaScript function to the clipboard. These functions work on JavaScript console as well. To understand better let’s look into the examples one by one. Example Following is the example program we used copyText() method to copy text to clipboard using JavaScript function. Copy text ...

Read More

How to create table header in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 9K+ Views

To create table header in HTML, use the … tag. A table header tag is surrounded by the table row …. The tag is surrounded by the tag. A table consist of a rows and columns, which can be set using one or more , , and elements. Use the style attribute to add CSS properties for adding a border to the table. A table row is defined by the tag. To create table header, use the tag. Just keep in mind that you can only have a single heading in a table. Syntax ...

Read More

How to make an image responsive in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 6K+ Views

Responsive images will automatically adjust to the size of the screen and to the tab size. To make image responsive first we must add image to the web page using tag, then by using style sheet we can change the parameters of the image to make an image responsive in HTML. Syntax Following is the syntax to make an image responsive in HTML. Example Following is the example program to make an image responsive in HTML. In here, we have used inline style sheet. DOCTYPE html> Responsive Image ...

Read More

How to create a bookmark link in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 18-Nov-2022 15K+ Views

A bookmark is helpful when you want to remember the web page for future reference. You can access that bookmark at any time to view the web page again. We use HTML links to create bookmarks, so that we can jump to specific parts of a web page. Bookmarks can be useful if a web page is long. When we click on the link, the page will scroll down or up to the location with the bookmark specified on the web page. Syntax First, we should use the id attribute to create a bookmark text… Then, add a link ...

Read More
Showing 31–40 of 67 articles
Advertisements