- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6685 Articles for Javascript
994 Views
In this tutorial, we will learn why to split the tag when writing it with the document.write(). The script tag in HTML is added to execute JavaScript code on the webpage. The JavaScript programs must be enclosed with the script tag to execute. There are many methods in JavaScript that add HTML content to the page, like the document.write() method. The document.write() method is used to delete all the content from the HTML tag or the document and add the content specified in this method to the page. Because of performance degradation and errors in certain conditions, this method ... Read More
76K+ Views
In this tutorial, we shall learn to stop form refreshing the page on submitting in JavaScript. Let’s cover the methods to accomplish this objective. Using event.preventDefault() to stop page refresh on form submit In this section, we will see how to use event.preventDefault() to stop page refresh on form submission. The event.preventDefault() restricts the default page refresh behavior of the form during form submission. Users can follow the syntax below to try this method. Syntax The syntax defines the form. //Get form element var form=document.getElementById("formId"); function submitForm(event){ ... Read More
356 Views
In this tutorial, we will learn if it is possible to write data to files using only JavaScript. JavaScript has a library named fs (short form of File-System) that manages all writing operations. It is a JavaScript program (fs.js) with functions for writing operations. Utilize functions to write text to system files by importing the fs module into the program. For example, the writeFile() function will erase all old data from a file and create a new one with the specified name if there isn’t already one. It is mainly used for writing operations. The File-System module is a handy ... Read More
464 Views
In this tutorial, we will learn about how to Access the Correct “this” inside a callback. “this” keyword Each function contains a keyword called this, also known as “the context, ” whose value is determined by how the function was called and not by how, when, or where it was defined. Unlike other variables, it is unaffected by lexical scopes. Compared to other languages, JavaScript acts a little differently when a function’s “this” keyword is used. Between strict mode and non-strict mode, there are several further changes. How a function is called most often determines the value of “this” (runtime ... Read More
3K+ Views
We can Use the canvas.toDataURL() to capture HTML canvas as different file formats, such as gif, png, jpg, webp, etc. Capture HTML Canvas as png Example Herein, after using canvas.DataURL(), set the type to image/png to allow saving the image as PNG − window.onload = function() { var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("2d"); context.fillStyle ... Read More
974 Views
We can find the specific condition with the help of the _.whare() function. The _.where() belongs to underscore.js a javascript library that provides versatile functions. The _.where() is a function used to find the specific element according to the given conditions. Suppose you want to find all the user details of the class and then apply the _.where() function to the list of all the sections and pass the condition as the section name. So the name of all the users with the specific condition will be returned. Syntax _.where( list, [predicate], [context] ) The function accepts three-argument as ... Read More
889 Views
In this tutorial, you will learn about JavaScript decorators and get to know about their inner workings and uses. What are Decorators in JavaScript? The word decorator means combining a set of code or program with another or can be said as wrapping a function with another function to extends the functionality or working of the function. Decorator can also be called as decorator function. Developers have been using this decorator term in other languages like python, C# and now JavaScript has also introduced the decorator. Function decorators In JavaScript functions behaves like objects so they are also known as ... Read More
1K+ Views
In this tutorial, you will learn about JavaScript DOM manipulation using a service worker. DOM manipulation happens is when we change the structure and elements of the document object model(DOM). We can modify DOM by adding, removing, Changing, or modifying elements and their attributes. What is a Service worker? Service workers work like proxy servers between web browsers and the web server. It adds enhancement to the existing websites in case the user’s browser doesn’t support the service worker but he visits any website that uses the service worker then also no function gets affected. It acts between web applications, ... Read More
6K+ Views
In this tutorial, you will learn about the procedure to upload images in firebase using HTML and JavaScript. Firebase − Firebase is a cloud-based storage platform that is a product of google which provides storage services that are used in various web and mobile application development. It provides NoSQL and real-time hosting of the database, authentication, notification, content, and many more services. Steps to upload an image using HTML and JavaScript in Firebase To connect firebase to the project, you should create a project on firebase here is the step-by-step procedure to create and activate the storage service to upload ... Read More
4K+ Views
In this tutorial, you will learn how to create an audio and video recorder using JavaScript MediaRecorder API. So this can be done using WebRTC. What is WebRTC? WebRTC is a short form of Real-Time Communication. We can access and capture the Webcam and Microphone devices that are available there in the user device. We can access the user device’s Webcam and microphone using an ECMAScript object navigator.mediaDevices.getUserMedia(constraints). So, the getUserMedia function by default, seeks user permission to use your Webcam. This function returns a promise and once you click ok and give the consent, then the function ... Read More