Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 69 of 80

How to get the largest integer less than or equal to a number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 892 Views

In this tutorial, we will learn how to get the largest integer that can be less than or equal to a number in JavaScript. To get the largest integer less than or equal to a number, we use the Math.floor() method in JavaScript. It is used to round off a number supplied as a parameter to its closest integer towards the downward direction of rounding, i.e., towards the less significant value. Following are two ways in which we find the largest integer that can be less than or equal to a number in JavaScript. Using Math.floor() Method The method Math.floor() ...

Read More

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

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 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 include JavaScript in HTML Documents?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 1K+ Views

In this tutorial, we will learn how to include JavaScript in HTML Documents. To include JavaScript in HTML Documents, use the tag. JavaScript can be implemented using JavaScript statements that are placed within the ... . You can place the tags, containing your JavaScript, anywhere within your web page, but it is normally recommended that you should keep it within the tags. We will discuss the following three approaches to include JavaScript in HTML documents − Embedding code (within head or body) Inline Code (inside any element) External file (outside the HTML file) By Embedding ...

Read More

How to handle tabs, line breaks and whitespace in a text in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 2K+ Views

In this tutorial, we will learn how to handle tabs, line breaks, and whitespace in a text in JavaScript. To handle tabs, line breaks, and whitespace in text in JavaScript, we can use the whiteSpace property. This property has seven attributes − normal nowrap pre pre-line pre-wrap initial inherit Generally, in HTML we use the   entity for multiple spaces and the tag to get line break. But in JavaScript, we use different attribute properties (mainly the normal and pre) of white-space properties to handle the tabs, line breaks, and multiple whitespaces. The details of these two ...

Read More

How to play a multimedia file using JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 2K+ Views

In this tutorial, we will learn how to play a multimedia file using JavaScript. The multimedia file is the audio and video files. The multimedia files can be of different formats. wav and mp3 are two examples of audio file formats, whereas mp4 and mkv are examples of video file formats. In HTML, multimedia files can be shown easily using different tags. We use the video tag for showing a video, and for audio, we use the audio tag. These two tags are quite similar, and many attributes are the same in both tags. The "src" attribute defines the path ...

Read More

How to pass JavaScript Variables with AJAX calls?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 11K+ Views

In this tutorial, we will learn how to pass JavaScript Variables with AJAX calls. AJAX stands for Asynchronous JavaScript and XML. As the name suggests, it performs asynchronous operations on your web page. AJAX communicates with the server by HTTP requests and gets the required data as an HTTP response. We can control these HTTP requests by passing the JavaScript variables with AJAX calls. There are various types of HTTP requests, and in this tutorial, we will discuss the most popular HTTP requests by using AJAX and also pass JavaScript variables with it. Pass JavaScript Variables with “GET” AJAX calls ...

Read More

How to get the number of seconds between two Dates in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Sep-2022 21K+ Views

In this tutorial, we will learn how to get the number of seconds between two dates with JavaScript. There are different methods for checking the number of days, hours, and seconds that are commonly used to provide information related to data. Since you can’t manually change the count of the years and months, we follow some simple tricks to get the number in JavaScript. Using the Date getTime() Method In JavaScript, we use different methods to calculate the days, hours, and seconds. Most popular way to calculate the time is .getTime(). However, you will get the result in milliseconds and ...

Read More

How to preselect a <select> list item using JavaScript?

Shubham Vora
Shubham Vora
Updated on 14-Sep-2022 283 Views

In this tutorial, we will learn how to preselect a select list item using JavaScript. It is given an id attribute to be associated with a for accessibility purposes and a name attribute represents the name of the associated data point submitted to the server. element nestled inside the is used to define each menu option. Each element have a value attribute that contains the data value to submit to the server when that option is selected. If no value attribute is specified, the value is set to the text contained within the element.You can include ...

Read More

How to invoke a JavaScript Function with 'new' Function Constructor?

Shubham Vora
Shubham Vora
Updated on 14-Sep-2022 847 Views

In this tutorial, we will learn how to invoke a JavaScript Function with the 'new' Function Constructor. Functions are a set of reusable codes that perform a specific task and may return a value. In JavaScript, functions are defined by the keyword function. A function may not have any parameters and may also not have any return statement. In JavaScript, we also have functions with no function names, called anonymous functions Using the 'new' Function Constructor The Function constructor makes a new Function object. By using the constructor, we can create a function dynamically. It takes parameters, or arguments, and ...

Read More

How to invoke a JavaScript Function as a method?

Shubham Vora
Shubham Vora
Updated on 14-Sep-2022 1K+ Views

In this tutorial, we will learn how to invoke a JavaScript Function as a method. In JavaScript, the code inside a function will execute when the function is invoked. We can invoke a function in a variety of ways. One of them is using the method. The method is a property of an object that has a function value. We can define functions as object methods. This function will have a function name, a parameter (optional), and a return type (optional). It will have a "this" keyword which refers to an object. Users can follow the syntax below to declare ...

Read More
Showing 681–690 of 793 articles
« Prev 1 67 68 69 70 71 80 Next »
Advertisements