Javascript Articles - Page 565 of 671

How to stop form submission using JavaScript?

Abhishek
Updated on 06-Sep-2023 13:02:30

62K+ Views

In this tutorial, we will see the methods to stop form submission using JavaScript. Generally, the HTML form by default submitted automatically if we try to perform some operations by using some events. The automatic submission of the form leads the browser to refresh and reload the whole page again, which we don’t want to perform in some cases. So, to perform any operation before submission we need to change the default behavior of the form to prevent it from submission. Following are the methods we can use to stop form submission − Using the "return false" value Using ... Read More

Why does the JavaScript need to start with “;”?

Ramu Prasad
Updated on 23-Jun-2020 11:51:06

166 Views

JavaScript uses a semi-colon (;) to avoid any confusion in code, especially the beginning of a new line.ExampleYou can still use the following to avoid any chaos in the code −return {    'var':myVal } // using semi-colon; (function( $ ) {    // }

How to set the style of the left border with JavaScript?

Shubham Vora
Updated on 22-Nov-2022 07:33:53

306 Views

In this tutorial, we shall learn how to set the style of the left border with JavaScript. To set the style of the left border in JavaScript, use the borderLeftStyle property. Set the style under this property that you want for the border i.e. solid, dashed, etc. Let us discuss our topic in brief. Using the borderLeftStyl Property With this property, we can set or return the style of the left border of an element. Users can follow the syntax below for using this property. Syntax object.style.borderLeftStyle = style; This syntax allows the required border style to be ... Read More

How and why does 'z'['toUpperCase']() in JavaScript work?

Shubham Vora
Updated on 22-Aug-2022 09:04:13

270 Views

In this tutorial, we will learn how and why ‘z’[‘toUpperCase’]() works in JavaScript. From the given format, we can say that it calls the toUpperCase() method for the ‘z’ string. It will work the same as the toUpperCase() method, which we invoke by taking any string as a reference. Let’s understand the syntax of the ‘z’[‘toUpperCase’]() below. Syntax let result = 'z'['toUpperCase'](); // returns 'Z', string in upper case The above syntax is same as the below. Example let string = 'z'; let result = string.toUpperCase(); Why does ‘z’[‘toUpperCase’]() work? In JavaScript toUpperCase() method is used to convert ... Read More

Set whether or not an element should be visible while not facing the screen with JavaScript?

Monica Mona
Updated on 23-Jun-2020 12:03:19

212 Views

Use the JavaScript backfaceVisibility property to set whether or not an element should be visible while not facing the screen.ExampleYou can try to run the following code to learn how to implement a backfaceVisibility property in JavaScript −Live Demo                    div {             width: 200px;             height: 300px;             background: blue;             color: black;             animation: mymove 2s infinite linear alternate;          }          @keyframes mymove {             to {transform: rotateY(180deg);}          }                     Check below to display backface                Demo             backfaceVisibility Property                function display(x) {             if (x.checked === true) {                document.getElementById("box").style.backfaceVisibility = "visible";             } else {                document.getElementById("box").style.backfaceVisibility = "hidden";             }          }          

How to create JavaScript data grid for millions of rows?

Nancy Den
Updated on 23-Jun-2020 11:51:58

315 Views

To display million of rows of data to the users in a grid, use any of the following grids −S. NoGridDescription1DataTablesAllows adding advanced interaction controls to any HTML table.2IngridAllows resizing columns, paging, sorting, row and column styling to tables.3SlickGridUses virtual rendering to allow you to work with hundreds of thousands of items.Let us see the features of SlickGrid −Easily customizableComplete keyboard navigationEasily handles hundreds of thousands of rowsQuick rendering speedColumn autosizing availablePluggable cell formatters availableAllos creating new rows

Is their a JavaScript Equivalent to PHP explode()?

Ankith Reddy
Updated on 23-Jan-2020 07:05:08

2K+ Views

The JavaScript equivalent to PHP explode() is split(). To get the data after the first colon, try to run the following code.Example                    var str = '087000764008:Rank:info:result';          var arr = str.split(":");          document.write(arr[1] + ":" + arr[2]);          

How to hide HTML element with JavaScript?

Shubham Vora
Updated on 10-Sep-2023 07:49:14

54K+ Views

In this tutorial, we will learn how to hide HTML element with JavaScript. Hiding an HTML element can be performed in different ways in JavaScript. In this tutorial, we will see the three most popular ways of doing it − Using the hidden property Using the style.display property Using the style.visibility property Generally, we use the hidden attribute to hide a particular element. We can toggle between hiding and showing the element by setting the hidden attribute value to true or false, respectively. In the other two ways, we use the style object of the element. We ... Read More

How to set the color of the left border with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 11:15:46

693 Views

In this tutorial, we will learn how to set the color of the left border with JavaScript. To set the color of the left border in JavaScript, use the borderLeftColor property. Set the color on this property that you want for the border. We could also apply the borderColor property to set the color of the left border. A border is an HTML element's outline. Different sides can be set with different border colors. To set the color of the left border with JavaScript, we have different ways − Using the style.borderLeftColor property Using the style.borderColor property Using ... Read More

How to display HTML element with JavaScript?

Shubham Vora
Updated on 31-Oct-2022 07:18:48

6K+ Views

In this tutorial, we will learn how to display an HTML element using JavaScript. HTML elements are the components that make up an HTML format file. These components are in charge of constructing web pages and defining their content. In HTML, an element typically consists of a start tag (tag name), a closing tag (tag name), and any text that is added in between. A collection of end tags, start tags, content, and attributes is what constitutes an element technically. Some HTML elements are − Starting Tag Content Ending Tag This is a paragraph. ... Read More

Advertisements