Found 10483 Articles for Web Development

How to select multiple options in a dropdown list with JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 08:14:24

11K+ Views

In this tutorial, we are going to learn how to select multiple options in a dropdown list with JavaScript. Basically, we are going to make two buttons, one is a drop-down button in which we provide more than one option, and another is a normal button connected to the multiFunc() function with an id of the dropdown button, when we click this button then we are able to select multiple options in the drop-down button. In this tutorial we are using two properties of JavaScript one is DOM property i.e. document.getElementById and another one is multiple properties use to choose ... Read More

How to get the id of a form containing a dropdown list with JavaScript?

Shubham Vora
Updated on 15-Sep-2022 12:20:37

5K+ Views

In this tutorial, we will learn how to get the id of a form containing a dropdown list using JavaScript. The id property of an HTML element gives a unique id. The id property value must be unique inside the HTML content. The style sheet property points to a specific declaration of style. JavaScript also uses it to access and alter the element with the specified id. The id property is used to provide an element with a unique identifier. On a web page, you cannot have more than one element with the same id. A dropdown menu in a ... Read More

How to find the value of a button with JavaScript?

Abhishek
Updated on 21-Oct-2023 13:33:58

31K+ Views

In this tutorial, we will learn how we can find the value of a button with JavaScript. Sometimes, we need to use the button tag inside the form tag, where we assign a particularly unique value to each associated with the element using the value attribute. Which later helps the developer to uniquely identify the elements while working with them in the back end. JavaScript provides us with the value property to get the value passed inside the value attribute Let us discuss the value property in detail. Button value Property The button value property is used to get ... Read More

How to find the text visible on the button with JavaScript?

Abhishek
Updated on 31-Oct-2022 08:04:54

10K+ Views

In this tutorial, we will discuss different approaches to find the text visible on the button with JavaScript. The text on a button shows what will happen if you click the button. To extract the text on the button, JavaScript provides us with the following two properties. Using the innerHTML Property Using the innerText Property Let us discuss both of the above properties in detail. Using the innerHTML Property The innerHTML property not only allows us to get the text inside any tag but also allows us to set the text to any tag. This property also allows ... Read More

How to find the id of the form a button belongs to in JavaScript?

Abhishek
Updated on 31-Oct-2022 07:55:45

5K+ Views

In this tutorial, we will learn how we can find the id of the form element to which a button belongs using JavaScript. In HTML, we can use button tag in two ways with form tag, where it can be used to perform some activity in the form when it is clicked, as listed below − Button is inside the FORM tag Button is outside the FORM tag No matter where the button is located, whether it is inside or outside, we can find the ID of the form tag to which the button belongs using JavaScript. Let ... Read More

How to convert String to Number in JavaScript?

Shubham Vora
Updated on 20-Sep-2024 10:43:37

837 Views

To convert string to number in JavaScript, it helps user to perform accurate mathematical operations, comparisons and handling form inputs. We will be discussing various approaches with example codes for each approach to convert string to number in JavaScript. In this article, we are having a string value, our task is to convert string to number in JavaScript. Approaches to Convert String to Number in JavaScript Here is a list of approaches to convert string to number in JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. ... Read More

How to use JavaScript to replace the content of a document with JavaScript?

Abhishek
Updated on 25-Nov-2022 07:35:35

3K+ Views

In this tutorial, we will learn how we can use JavaScript to replace the content of a HTML document. In JavaScript, we can change the content of HTML document with a combination of following methods − open − The open method is used to open a new document which takes two arguments as text/html and replace, where first argument will define the type of new document to be formed and the later one will replace all the adds history on the previous page and help to open new document with ease. document.open("text/html", "replace"); write − After creating ... Read More

How to convert Number to String in JavaScript?

Shubham Vora
Updated on 10-Aug-2022 12:29:28

4K+ Views

This tutorial will teach us to convert the number to string in JavaScript. Changing the type of variable is called the type conversion of a variable. While coding, the programmer needs to deal with the different data types and might need to convert the variable's data type. Every programming language has different methods to convert one variable from one data type to another data type, and JavaScript also has some methods, which are explained below. Using the toString() Method Concatenating with an empty String Using the string() Constructor Using the toString() Method In JavaScript, the toString() method is ... Read More

How to show the full URL of a document with JavaScript?

Abhishek Kumar
Updated on 21-Sep-2022 07:46:36

2K+ Views

We use the URL property of the document object to show the full URL of a document with JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It Contains all the information about the condition of the browser as well as the web page. It can be visualized as a hierarchy that is obtained after rendering the HTML structure of the web page. URL stands for Uniform Resource Locator. It contains the address of a resource on the internet. A Typical URL looks something like this− http://www.example.com/index.html It is ... Read More

How to show the date and time the document was last modified with JavaScript?

Abhishek Kumar
Updated on 21-Sep-2022 07:38:53

5K+ Views

We use the lastModified property of the document object to show the date and time the document was last modified with JavaScript. This command will provide the exact date and time of modification. The document object, part of the DOM, renders the whole HTML as a hierarchy of objects and their properties as well as stores different attributes of the webpage. document.lastModified It is a read-only property of the document object that returns a string containing the date and time, the document was last modified. The format looks something this: 07/29/2019 15:19:41 Note − The lastModified property is useful ... Read More

Advertisements