Javascript Articles - Page 586 of 671

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 convert String to Boolean in JavaScript?

Fendadis John
Updated on 20-May-2020 08:55:35

290 Views

You can try to run the following to learn how to convert String to Boolean in JavaScript.ExampleLive Demo           Convert String to Boolean                var myString = "Amit";          document.write("Boolean : " + Boolean(myString));          

How to return a number indicating the Unicode value of the character?

Alankritha Ammu
Updated on 23-Jun-2020 08:41:29

380 Views

The charCodeAt() method returns a number indicating the Unicode value of the character at the given index. Unicode code points range from 0 to 1, 114, 111. The first 128 Unicode code points are a direct match of the ASCII character encoding.The following parameter is supported by charCodeAt(index) −index − An integer between 0 and 1 less than the length of the string; if unspecified, defaults to 0.ExampleYou can try to run the following code to return a number indicating the Unicode value of the character −           JavaScript String charCodeAt() Method           ... Read More

How to find the value of a button with JavaScript?

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

32K+ 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

What records are present in JavaScript cookies?

Daniol Thomas
Updated on 23-Jun-2020 08:46:46

209 Views

Your server sends some data to the visitor's browser in the form of a cookie. The browser may accept the cookie. If it does, it is stored as a plain text record on the visitor's hard drive. Now, when the visitor arrives at another page on your site, the browser sends the same cookie to the server for retrieval. Once retrieved, your server knows/remembers what was stored earlier.Cookies are a plain text data record of 5 variable-length fields −Expires − The date the cookie will expire. If this is blank, the cookie will expire when the visitor quits the browser.Domain − The ... Read More

How to display a string in the fixed-pitch font?

Moumita
Updated on 20-May-2020 08:47:55

175 Views

Use the JavaScript fixed() method to display in fixed-pitch font as if it were in a tag.ExampleYou can try to run the following code to display a string in the fixed-pitch font.           JavaScript String fixed() Method                        var str = new String("Hello world");          alert(str.fixed());          

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

849 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

Advertisements