jQuery Access Internal Event-related Data through _data() method

jQuery internally stores and maintains the list of events which was attached or detached from DOM elements. Meanwhile, jQuery data mechanism jQuery._data() – the “undocumented” method – which allow us to access the jQuery internal event-related data structure. As of jQuery 1.8, the event data is no longer available from the “public API” for data. […]

Continue reading

JavaScript: Void Operator Explanation

The void is a operator that always returns undefined after evaluate a given expression The void operator allows inserting expressions that produce side effects into places where an expression that evaluates to undefined is desired. Syntax:

It is often used merely to obtain the undefined primitive value, usually using void(0) (which is equivalent to […]

Continue reading

JavaScript: Date Object Functionality

The built-in object for date and time in JavaScript is Date. It handles all functionality: creation, modification and, partially, date formatting. Constructors Getter methods Setter methods Auto-adjusting Numeric conversion, date diff Formatting Parsing from string, Date.parse 1. Constructors The syntaxes to create a Date are: 1. new Date(): Creates a Date object with current date […]

Continue reading

JavaScript: Getting the Number of Keys/Properties of an Object

The standard Object implementation (ES5.1 Object Internal Properties and Methods) does not require an Object to track its number of keys/properties, so there should be no standard way to determine the size of an Object without explicitly or implicitly iterating over its keys. Here are the most commonly used alternatives: 1. ECMAScript’s Object.keys() Object.keys(obj).length; Works […]

Continue reading

JavaScript Infinite Scroll with Cross-Browser

Here meant to explain how to create cross-browser compatible infinite scroll solution with JavaScript. Infinite Scroll is also called autopagerize, unpaginate, endless pages. Essentially it detects when user reaches end of an HTML element or the bottom of page. i.e., finished reading and then loading new data asynchronous using AJAX and displaying it. Therefore the […]

Continue reading

JavaScript Prototype Concept

JavaScript prototype concept is always a controversial topic. Here is the explanation that how does JavaScript .prototype work. This is a very simple prototype based object model that would be considered as a sample during the explanation, with no comment yet:

There are some crucial points that we have to consider before going through […]

Continue reading

JavaScript: Clone/Deep Copy an Object

There is a common gotcha that programmers making a copy of object in javascript with setting two variables copy and original equal to the same object sourceObject.

It actually creates a reference pointing to that same object. Both variables copy and original can reach into the contents of “sourceObject”. Any changes or updates properties […]

Continue reading