Found 6704 Articles for Javascript

How to Count all Child Elements of a Particular Element using JavaScript?

Jaisshree
Updated on 18-Aug-2023 17:06:51

855 Views

Child Node A node that is immediately nested inside another node in a document tree or DOM (Document Object Model) tree is referred to as a child node in JavaScript. Child nodes are in specific HTML elements, text nodes, and comment nodes that are nestled inside of other HTML elements when working with HTML documents. Method 1: Using the childNodes Property Utilizing the childNodes property is one method of counting child components. The NodeList of all child nodes, including text nodes and remarks, is returned by this property. We can loop through the NodeList and examine each node's nodeType property ... Read More

How do I export my HTML page as a PDF using JavaScript?

Ayush Singh
Updated on 17-Aug-2023 10:59:21

8K+ Views

An HTML page can be converted into a PDF file using JavaScript tools like jsPDF or html2pdf.js. These libraries make it easier to generate PDF files directly from web page HTML text. Users will have the choice to download or save the finished PDF when the HTML elements and their corresponding styles have been captured and converted to PDF format. One may easily enable this functionality and provide the convenience of printable, offline content representation by inserting necessary JavaScript code into the web application. This functionality is useful for producing reports, producing printable versions of web material, and giving consumers ... Read More

How can I get the HTML/CSS/JavaScript source code of a website?

Ayush Singh
Updated on 17-Aug-2023 10:42:37

1K+ Views

The Internet, which gives a colossal determination of sites going from direct static pages to unpredictable web applications, has changed how we communicate with data and administrations. Behind the stylishly lovely UIs and intuitive components are three fundamental web innovations: HTML, CSS, and JavaScript. For those inquisitive about how these innovative marvels work, getting to a site's source code can be a tomfoolery experience. We'll walk you through each move toward this instructional exercise on the most proficient method to get to the HTML, CSS, and JavaScript source code utilizing the implicit designer apparatuses in your internet browser. Methods Used ... Read More

How to Convert Characters to ASCII Code using JavaScript?

Jaisshree
Updated on 09-Aug-2023 16:53:01

1K+ Views

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

253 Views

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

2K+ Views

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

2K+ Views

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

1K+ Views

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

3K+ Views

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

4K+ Views

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

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