Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Shubham Vora
Page 2 of 80
How to add HTML and CSS to PDF?
In this tutorial, we will learn how to convert HTML and CSS content to PDF using JavaScript libraries. Creating PDFs from web content allows users to save styled webpages, forms, reports, or any HTML content as downloadable documents. Converting HTML and CSS to PDF from scratch using vanilla JavaScript is complex and requires extensive coding. Fortunately, several JavaScript libraries simplify this process by providing easy-to-use methods for generating PDFs from web content. We will explore two popular libraries − html2pdf.js and jsPDF − both of which can convert styled HTML content into PDF documents directly in the browser. ...
Read MoreHow to include another HTML file in an HTML file?
In this tutorial, we will learn different methods to include another HTML file within an existing HTML file. This technique is useful for creating reusable components, headers, footers, or content sections that can be shared across multiple pages. Several methods are available to include external HTML files, each with its own advantages and use cases. Let us explore the most effective techniques that have proper web browser support. Using jQuery Load Method The jQuery load() method is one of the most popular approaches for dynamically including HTML content. It fetches content from an external file and inserts ...
Read MorePOST unchecked HTML checkboxes
In HTML forms, checkboxes that are unchecked are not included in form submissions by default. This can create issues when you need to track the state of all checkboxes, not just the ones that are checked. This tutorial demonstrates how to POST unchecked HTML checkboxes to ensure complete form data is sent to the server. HTML forms typically send only data from checked checkboxes when using POST or GET methods. Unchecked checkboxes are omitted entirely from the submitted data, making it impossible for the server to distinguish between an unchecked checkbox and a checkbox that doesn't exist. This behavior ...
Read MoreHow to show some custom menu on text selection?
In text editors like Microsoft Word, selecting text reveals a custom menu with formatting options like bold, italic, color changes, and alignment controls. This tutorial demonstrates how to create a similar custom context menu that appears when users select text on a webpage. How It Works The technique involves capturing mouse coordinates during selection and positioning a custom menu at the selection point. We use the getSelection() API to detect when text is selected and getBoundingClientRect() to calculate the menu position. Implementation Steps Step 1 − Create HTML structure with content div and hidden custom ...
Read MoreHow to store data to DOM?
Storing data in the DOM means keeping data associated with HTML elements or in JavaScript variables that can be accessed later. This is useful for maintaining application state, form data, or temporary values without making server requests. In vanilla JavaScript, we can store data in objects or use element properties. jQuery provides the data() method for attaching data to specific DOM elements. Let's explore both approaches. Using JavaScript Objects to Store Data The most common approach is creating JavaScript objects to hold data. This keeps information organized and easily accessible. Syntax let dataObj = ...
Read MoreHow to store JavaScript functions in a queue and execute in that order?
In JavaScript, you may need to store functions in a queue and execute them in a specific order. Since JavaScript doesn't have a built-in queue data structure, we can use arrays with push() to enqueue functions and shift() to dequeue them. This pattern is useful for managing asynchronous operations, implementing task schedulers, or controlling execution flow in applications. Basic Queue Operations A function queue uses these core operations: Enqueue: Add function to the end using push() Dequeue: Remove and execute function from the front using shift() Execute: Call functions in First-In-First-Out (FIFO) order ...
Read MoreFirebase Integration with Web
Firebase is a comprehensive Backend-as-a-Service (BaaS) platform launched by Google in 2011 and acquired in 2014. It provides real-time databases, user authentication, cloud storage, hosting, and analytics for mobile and web applications. Its popularity stems from quick setup, scalability, and seamless integration. In this tutorial, we will learn to integrate Firebase authentication into a single-page web application, creating a complete user management system with signup, login, and logout functionality. Setting Up Firebase Project Follow these steps to create and configure your Firebase project: Step 1 − Visit Firebase and create a Google ...
Read MoreHow to switch the language of the page using JavaScript?
Whenever you develop a website or application for a worldwide business, you must also focus on which language your audience can understand. For example, English is an international language, but in some parts of the world, people don't understand English as they speak German, Spanish etc. However, if you have observed, then some websites provide the option to change the website's language. You just need to click on the button, which changes the whole website's language. Have you ever thought about how it is possible? Here, we will learn to switch the language of the web page using ...
Read MoreFirebase to get url
Firebase is a backend-as-a-service (BaaS) that provides different services including authentication, cloud storage, hosting, and more. It makes it easy for developers to integrate these features into mobile or web applications. In this tutorial, we will explore Firebase Cloud Storage to upload images and retrieve their URLs for use in web applications. Firebase Project Setup Follow these steps to set up a Firebase project and configure cloud storage: Step 1 − Go to Firebase and create an account. Step 2 − Open the Firebase Console. Step 3 − Click the 'Create project' button to start ...
Read MoreHow to throw an error in an async generator function in JavaScript ?
Async generator functions combine asynchronous operations with generator functionality. When errors occur in async generators, they need special handling using throw() method or try-catch blocks with for await...of loops. What are Async Generator Functions? Async generators use async function* syntax and can yield values asynchronously. They return an async iterator that can be consumed with for await...of loops. Basic Async Generator Example let content = document.getElementById('content'); ...
Read More