Found 7014 Articles for Javascript

How to Convert Characters to ASCII Code using JavaScript?

Jaisshree
Updated on 09-Aug-2023 16:53:01
ASCII, stands for American Standard Code for Information Interchange which is a method used for encoding characters by assigning them to a specific numerical value. The numerical values thus assigned are known as ASCII codes and are extensively utilized in computer systems to represent various characters including letters, numbers, punctuation marks, and special control characters. Example 1: Using charCodeAt() The following code illustrates a program to receive input character from the user using the ‘charCodeAt()’ function and then display the corresponding ASCII code for that character. Syntax string.charCodeAt(index) Algorithm Step 1 :Start with declaring the HTML tag. Step ... Read More

How to convert a DOM Nodelist to an Array using JavaScript?

Jaisshree
Updated on 09-Aug-2023 16:45:07
To write javascript advanced code you can run across instances where you need to convert a DOM (Document Object Model) NodeList to a more adaptable data structure like an array. Although nodelist is just like an array in any programming language. However, it does not contain fever characteristics than an array. You can use Javascript to convert a nodelist into an array to work more appropriately. Example 1 This example provides code to convert a nodelist into an array using javascript. The code uses the nodeListToArray function to perform the conversion. Algorithm Step 1 :Create an array ... Read More

How to Highlight the Searched String Result using JavaScript?

Mrudgandha Kulkarni
Updated on 07-Aug-2023 19:40:12
Searching for specific content within a large body of text is a common task in web applications. However, simply displaying the search results without any visual indication can make it challenging for users to identify and focus on the relevant information. That's where the need for highlighting the searched string arises. By dynamically highlighting the matching portions of the text, we can improve the user experience and make it easier for users to locate the desired content. In this blog post, we will explore different methods to highlight the searched string using JavaScript. We'll cover various techniques that range from ... Read More

How to hide the table header using JavaScript?

Mrudgandha Kulkarni
Updated on 07-Aug-2023 19:42:52
Tables are a common element in web development, used to organize and present data in a structured format. While table headers provide valuable context and help users understand the content within a table, there are situations where hiding the table header becomes necessary. Whether it's to enhance the visual design, improve user experience, or accommodate specific requirements, knowing how to hide the table header using JavaScript can be a useful skill for web developers. In this article, we will explore different methods to hide the table header using JavaScript. We will cover techniques that leverage CSS, manipulate the Document Object ... Read More

How to hide span element if anchor href attribute is empty using JavaScript?

Mrudgandha Kulkarni
Updated on 07-Aug-2023 19:47:45
In modern web development, it's often necessary to dynamically hide or show elements based on certain conditions. One common requirement is to hide a element if the associated (anchor) element has an empty href attribute. This functionality can be particularly useful when working with navigation menus or links that are generated dynamically. In this article, we'll explore how to achieve this behavior using JavaScript. We'll delve into two different approaches: one utilizing JavaScript event listeners, and the other leveraging CSS selectors. By understanding both methods, you'll have the flexibility to choose the one that best suits your project ... Read More

How to Hide an HTML Element by Class using JavaScript?

Mrudgandha Kulkarni
Updated on 07-Aug-2023 16:09:44
When working with dynamic web pages, it's often necessary to hide certain HTML elements based on specific conditions or user interactions. One common approach is to assign classes to these elements and then dynamically hide them using JavaScript. This provides a flexible and efficient way to control the visibility of elements without modifying the HTML structure. In this article, we will explore how to hide HTML elements by class using JavaScript. We'll discuss the importance of dynamically hiding elements, understand the concept of HTML classes, and learn different methods to select elements by class using JavaScript. We will then dive ... Read More

File Type Validation while Uploading it using JavaScript

Nikhilesh Aleti
Updated on 04-Aug-2023 19:04:42
Social media platforms that focus solely on employment allow users to create an account and will be asked to upload the necessary documents so that the job recruiters can analyze them. To collect the documents from the user, these websites will provide an "Upload file" or "Choose file" option in their user details form; and they accept only particular file types such as ".pdf", ".jpg", ".png", etc. This process is called file validation and it can be done using JavaScript. In this article, we are going to design an option that validates the file types using JavaScript. To do so, ... Read More

DHTML JavaScript

Nikhilesh Aleti
Updated on 04-Aug-2023 17:34:54
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
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
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
1 2 3 4 5 ... 702 Next
Advertisements