Found 6704 Articles for Javascript

DHTML JavaScript

Nikhilesh Aleti
Updated on 04-Aug-2023 17:34:54

3K+ Views

DHTML stands for Dynamic Hypertext Markup Language. DHTML combines HTML, CSS, and JavaScript to create interactive and dynamic web pages. It allows for customization and changes to the content based on user inputs. Earlier, HTML was used to create static pages that only defined the structure of the content. CSS helped in enhancing the page's appearance. However, these technologies were limited in their ability to create interactive experiences. DHTML introduced JavaScript and the Document Object Model (DOM) to make web pages dynamic. With DHTML, the web page can be manipulated and updated in response to user actions, eliminating the ... Read More

How to dynamically insert id into a table element using JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 21:11:39

658 Views

In this article, we will learn how to dynamically insert IDs into a table element using JavaScrip with the help of setAttribute API. In web development, dynamically inserting an ID into an HTML table element can be a useful technique when we need to uniquely identify and manipulate specific rows or cells. By assigning IDs to table elements programmatically, we gain more control and flexibility in accessing and modifying the table's content. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we generate a random id for a table row by computing ... Read More

How to dynamically create new elements in JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 21:02:04

1K+ Views

In this article, we will learn how to dynamically create new elements in JavaScript with the help of the createElement browser API. Dynamic element creation in JavaScript allows you to generate new HTML elements on the get-go. Whether you need to add content to a web page based on user interactions or dynamically generate elements for a specific task, it can help enhance the flexibility and interactivity of web applications. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we will have a button element and on clicking it, we ... Read More

How to Draw Smooth Curve Through Multiple Points using JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 20:39:58

363 Views

In this article, we will learn how to draw smooth a curve through multiple points using JavaScript with the help of canvas browser API and HTML element. When it comes to visualizing data or creating interactive graphics on the web, drawing smooth curves through multiple points can greatly enhance the aesthetics and readability of the information. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we will leverage the concept of Brazier Curves which are defined by a set of control points to draw a smooth curve passing through them. We will ... Read More

How to display a warning before leaving the web page with unsaved changes using JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 20:36:12

1K+ Views

In this article, we will learn how to display a warning message before leaving the web page with unsaved changes using javascript with the help of the “beforeunload” event listener. When working on web applications or forms of any kind, it becomes necessary to provide a warning message to users before they leave a page with unsaved changes. This can prevent accidental data loss and improve the overall user experience. Let’s understand how we can implement this with the help of some examples − Example 1 In this example, we will have a form with multiple input elements and ... Read More

How to display errors without an alert box using JavaScript?

Dishebh Bhayana
Updated on 02-Aug-2023 20:16:29

752 Views

In this article, we will learn how to display errors inline on a page and without an alert box using javascript with the help of innerHTML and textContent properties of HTML DOM elements. While alert boxes can be useful for displaying errors to users, they can be disruptive and interrupt the user experience. A more elegant solution is to display errors inline on the page. Let’s understand how to achieve the above result with the help of 2 approaches Approach 1 In this approach, we will use the innerHTML DOM element property to display the error message inline in ... Read More

How to disable button element dynamically using JavaScript?

Dishebh Bhayana
Updated on 02-Aug-2023 19:15:37

1K+ Views

In this article, we will learn how to disable button HTML elements dynamically using javascript, with the help of the “disabled” attribute. The “disabled” attribute in HTML button elements accepts a boolean value (true or false), and depending on the value, it disables the button and makes it non-functional, i.e., not clickable. We can use this attribute to disable any button in HTML by setting the “disabled” attribute to “true”. Syntax Disabled Button Let’s understand this with the help of some examples − Example 1 In this example, we will disable a button element by passing the “disabled” attribute ... Read More

How to record and play audio in JavaScript?

Mohit Panchasara
Updated on 26-Jul-2023 12:38:11

2K+ Views

Are you also willing to add a custom audio recording feature to your web application? If yes, you are in the right place, as we will learn to record and play audio using JavaScript in this tutorial. Some applications like Discord allow you to record the audio and store it inside that to play it anytime. The recorded audio can also be used as a meme for fun, alerts in the discord meetings, etc. We can also use the mediaRecorder API of JavaScript to add the recording audio feature to our web application. Here, we will learn a step-by-step guide ... Read More

How to prevent overriding using Immediately Invoked Function Expression in JavaScript?

Mohit Panchasara
Updated on 26-Jul-2023 12:23:25

173 Views

JavaScript allows developers to add functionality and behaviors to the web page. Developers require to create multiple functions and variables to add functionality to different parts of the web page. While developing real-time applications, multiple developers work on the same project. So, avoiding the unintentional overriding of functions and variables while collaborating with multiple developers is necessary. In this tutorial, we will learn to prevent overriding using immediately invoked function expressions. Problem of Overriding For example, two colleagues are working on the same project, and both have defined the printAge() function inside the code and merged the code. Now, the ... Read More

Web Workers: Multithreading in JavaScript

Mukul Latiyan
Updated on 25-Jul-2023 14:47:49

124 Views

As web applications become more complex and demanding, the need for efficient and responsive processing becomes increasingly important. JavaScript, being a single-threaded language, can sometimes struggle with heavy computational tasks that may result in slow user interfaces and unresponsive applications. However, with the introduction of Web Workers, JavaScript gains the ability to leverage multithreading, allowing for improved performance and enhanced user experiences. In this article, we will delve into the world of Web Workers and explore how they enable multithreading in JavaScript. Understanding the Need for Web Workers In traditional JavaScript, the single-threaded nature means that all tasks, including DOM ... Read More

Previous 1 ... 4 5 6 7 8 ... 671 Next
Advertisements