Found 6685 Articles for Javascript

How to add Summernote Editor to the webpage in Javascript?

AmitDiwan
Updated on 13-Feb-2023 17:25:44

3K+ Views

To add Summernote Editor in a webpage, we first need to include the Summernote CSS and JS files in the head of our HTML document. Next, we need to initialize the Summernote editor on a specific text area or div element by calling the Summernote function on it. Finally, we can customize the editor's options and functionality by passing options as an object to the Summernote function. Let us first understand what Summernote editor is. What is Summernote? Summernote is a JavaScript library that allows for the creation and editing of rich text within a web page. It is ... Read More

How a Polygon is different from a Polyline in FabricJS?

Rahul Gurung
Updated on 16-Feb-2023 15:58:08

236 Views

We can create a Polyline object by creating an instance of fabric.Polyline while fabric.Polygon can be used to create a Polygon instance. A polyline object can be characterised by a set of connected straight-line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. A polygon always connects the first point to the last to make a closed area while a polyline doesn’t. This can be proved by the examples given below. Syntax new fabric.Polyline(points: Array, options: Object) Parameters points − This ... Read More

How to clear cache memory using JavaScript?

Rushi Javiya
Updated on 31-Oct-2023 02:57:17

28K+ Views

Cache memory, often known as cache, is a different memory system in a computer that stores frequently used data and instructions for a short period. While loading a website, the browser we are using will automatically cache some resources, such as images, scripts, and stylesheets, to be utilized again when the page is reloaded. This can shorten the time it takes for a website to load not only that but also it helps to lower the amount of data that has to be sent over the network. But this cache memory stored by the browser also has some disadvantages. If ... Read More

How to check whether the background image is loaded or not using JavaScript?

Rushi Javiya
Updated on 08-Feb-2023 20:26:32

1K+ Views

We mainly use JavaScript to create dynamic web applications. This kind of scripting language makes a web page look interactive. JavaScript significantly adds some logic to our website. As we mentioned, the user can check whether the background image is loaded. Web developers can understand that the page is loaded correctly and that the background image is displayed properly. To check whether the background image is loaded as directed by the web developers on the web page user can use the image object. We can access this object's properties and methods related to an image, and we can apply ... Read More

How to check the type of a variable or object in JavaScript?

Rushi Javiya
Updated on 08-Feb-2023 20:34:54

11K+ Views

JavaScript is a loosely typed programming language, meaning there is no such rule to declare the variable type. A variable can store multiple data types in a program, so it is essential to understand the variable type before using it. In JavaScript, we can use the typeof operator to check the type of a variable or object. The typeof operator takes a variable and returns its type in a string format. In addition, to the typeof operator, JavaScript also provides the instanceof operator to check the type of a variable or object. The instanceof operator accepts two arguments: the ... Read More

How to Check Mentioned File Exists or not using JavaScript/jQuery?

Rushi Javiya
Updated on 08-Feb-2023 20:37:26

6K+ Views

Using JavaScript or jQuery, we can check whether a file exists and retrieve metadata about the file, such as its size, content type, last modified date, etc., without retrieving the actual file. The HTTP HEAD request is used in this case. An HTTP HEAD request is a type of HTTP request that asks the server to return the HTTP headers for a specified resource without the actual resource itself. Several methods can be used to send an HTTP HEAD request, but the most popular way is to use the $.ajax() method and XMLHttpRequest object. Users can define the request ... Read More

How to use template string literal in ECMAScript 6?

Rushi Javiya
Updated on 08-Feb-2023 21:17:14

181 Views

In the ES6 version of JavaScript, literals are introduced. JavaScript contains object literals, array literals, Numeric literals, RegExp literals, etc. Also, it contains the string literals. The string literal allows us to create multiline strings without any backslash characters, add any word or sentence to the quote, and add variables and mathematical expressions in between the strings. Syntax Users can follow the syntax below to use the template string literal in ECMAScript 6. let string = `This is template literal string!`; In the above syntax, we have used the backticks (` `) to create a template literal string. ... Read More

How to add fade-out effect using pure JavaScript?

AmitDiwan
Updated on 06-Feb-2023 12:38:59

7K+ Views

We can add a fade-out effect using pure JavaScript by manipulating the element's style property. We can start by setting the element's opacity to 1 and then gradually decreasing it over time using the setInterval or setTimeout function. Finally, we can remove the element from the DOM once the opacity reaches 0. Fade-out Effect A fade-out effect is a visual transition where an element gradually becomes less visible over a period of time. This effect is commonly used in web design and animation to create a smooth transition between elements on a page or to hide an element from view. ... Read More

How to add default horizontal scaling to a canvas-type text with JavaScript?

AmitDiwan
Updated on 06-Feb-2023 12:30:31

220 Views

We can add default horizontal scaling to a canvas-type text by accessing the canvas context and setting the scale property to a specific value. This can be done by calling the context's scale method and passing in the desired value for the horizontal scaling. By doing this, all text drawn on the canvas will have the default horizontal scaling applied to it. HTML Canvas HTML canvas is a 2D drawing surface that can be used to create dynamic and interactive graphics, charts, and animations on web pages. It is an HTML element that allows developers to draw graphics using JavaScript. ... Read More

How to add content in section using jQuery/JavaScript?

AmitDiwan
Updated on 06-Feb-2023 12:23:53

1K+ Views

We can use jQuery's 'append' or 'prepend' method to add content to the section of a website. This can be done by selecting the element using jQuery's 'selector' method and then using the appropriate method to add the desired content. Additionally, we can also use JavaScript's 'innerHTML' property to add content to the section. There are quite some ways of adding content to head tag programmatically. Today we are going to discuss 3 of them − Using jQuery's .append() method − Using JavaScript's document.createElement() method − Using JavaScript's insertAdjacentHTML() method − Using these 3 ways ... Read More

Advertisements