Found 8895 Articles for Front End Technology

How to detect all active JavaScript event handlers?

Nishtha Thakur
Updated on 09-Jan-2020 10:20:19

587 Views

The simplest solution is to use jQuery to detect all active JavaScript event handlers.ExampleYou can try to run the following code to detect active event handlersLive Demo                          var myEvent = $("#demo");          myEvent.mouseover(function() {});          $.each(myEvent.data("events"), function(i, e) {             alert(i);          });                     Demo Text    

What is the difference between new operator and object() constructor in JavaScript?

Rishi Rathor
Updated on 17-Jun-2020 06:09:54

935 Views

The new operatorThe new operator is used to create an instance of an object. To create an object, the new operator is followed by the constructor method.In the following example, the constructor methods are Object(), Array(), and Date(). These constructors are built-in JavaScript functions.var department = new Object(); var books = new Array("C++", "Perl", "Java"); var day = new Date(“December 1, 2017");The object() constructorA constructor is a function that creates and initializes an object. JavaScript provides a special constructor function called Object() to build the object. The return value of the Object() constructor is assigned to a variable.The variable contains ... Read More

What are the differences between JavaScript and PHP cookies?

Anvi Jain
Updated on 03-Oct-2019 08:09:22

580 Views

JavaScript CookiesUsing JavaScript cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.PHP CookiesCookies are text files stored on the client computer and they are kept for tracking purpose. PHP transparently supports HTTP cookies.How JavaScript cookies work?Your server sends some data to the visitor's browser in the form of a cookie. The browser may accept the cookie. If it does, it is stored as a plain text record on the visitor's hard drive. Now, when the visitor arrives at another page on your site, the browser ... Read More

How to markup postal address in HTML?

Lokesh Badavath
Updated on 11-Nov-2022 09:20:03

3K+ Views

Addresses are used in physically locating a building. An address is a information, presented in a fixed format, used to give the location of a building, apartment, along with other identifiers are used such as house or apartment numbers. We use tag, to provide contact details on the web page. The HTML tag defines the contact information for the author of a document or an article on the web page. The contact information can be a building location, email address, URL, phone number, etc. The text in the element usually renders in italic format, and it ... Read More

How to define methods for an Object in JavaScript?

Nancy Den
Updated on 03-Oct-2019 08:07:09

86 Views

Methods are the functions that let the object do something or let something is done to it. There is a small difference between a function and a method – at a function is a standalone unit of statements and a method is attached to an object and can be referenced by this keyword.Methods are used for everything from displaying the contents of the object to the screen to performing complex mathematical operations on a group of local properties and parameters. Here’s an example showing how to use the write() method of the document object to write any content on the document.document.write("This ... Read More

How to detect that JavaScript Cookies are disabled?

Shubham Vora
Updated on 30-Aug-2022 06:38:50

4K+ Views

This tutorial will teach you how to detect if cookies are enabled or disabled on a website using JavaScript. Cookies are small text files on your computer that contain data. A web server terminates the connection after sending a web page to a browser and completely forgets about the user. The challenge of "how to remember information about the user" led to the invention of cookies. A cookie may contain the name of a user who visits a website. The cookie "remembers" the user's name for the subsequent visit to the website. Cookies allow you to store user information on ... Read More

How can I delete all cookies with JavaScript?

Vrundesha Joshi
Updated on 03-Oct-2019 08:06:06

1K+ Views

To delete all cookies with JavaScript, you can try to run the following code. Here, we’re using an array and the split() method to get all the cookies and finally delete themExampleLive Demo                    var num = 1;          function addCookie(){             document.cookie = num+" = "+num;             num++;          }          function listCookies(){             var result = document.cookie;             document.getElementById("list").innerHTML = result;          }          function removeCookies() {             var res = document.cookie;             var multiple = res.split(";");             for(var i = 0; i < multiple.length; i++) {                var key = multiple[i].split("=");                document.cookie = key[0]+" =; expires = Thu, 01 Jan 1970 00:00:00 UTC";             }          }                     ADD       LIST COOKIES       REMOVE       Cookies List          

How to create object properties in JavaScript?

Abhishek
Updated on 31-Oct-2022 09:06:45

311 Views

JavaScript object properties are the keys inside the body of a JavaScript object. Object properties can be any of the three primitive data types, or any of the abstract data types, such as another object. Object properties are usually variables used internally in the object's methods, but can also be globally visible variables that are used throughout the page. These properties can either be statically typed by the programmer at the time of object declaration, or they can be modified or created later according to the need. There are two ways of creating or adding properties to a JavaScript object ... Read More

How to use blockquote in HTML?

Lokesh Badavath
Updated on 11-Nov-2022 09:17:39

488 Views

The tag is to indicate long quotations. It should contain only block-level elements within it and not just plain text. It specifies a section quoted from another source and contains only block-level elements. We can also use the cite attribute inside the tag to indicate the source of the quotation in URL form. Syntax Following is the syntax for the tag. The multiple line content to be quoted Example Following is the example program for the tag. DOCTYPE html> DLF stands for Delhi Land and Finance ... Read More

How to use quotation marks in HTML?

Lokesh Badavath
Updated on 11-Nov-2022 09:14:47

5K+ Views

We use tag, to add short quotation marks in HTML. And if we want to quote for multiple lines, use tag. We can also use the cite attribute inside the tag to indicate the source of the quotation in URL form. Syntax Following is the syntax for the tag. The content to be quoted Example Following is the example program for the tag. DOCTYPE html> DLF stands for Delhi Land and Finance Delhi Land and Finance is one of the largest commercial real ... Read More

Advertisements