Categories
jQuery

Difference between $.each(selector) and $(selector).each()

In jQuery, there is an object iterator utility called $.each() as well as a jQuery collection iterator: .each() to run for each matched element. We can return false to stop the loop early. Syntax: $(selector).each(function(index,element)) Basically, $.each() is essentially a drop-in replacement of a traditional for or for-in loop. So, .each is an iterator which […]

Categories
jQuery

Abort Ajax requests using jQuery

Using jQuery abort() you can cancel a running AJAX request forcefully before it ends as this hits several times within a short time period. This is usually in cases where the user might perform an action, based on AJAX request several times within a short time period. For example, There is a auto-complete functionality for […]

Categories
Javascript jQuery

Difference between window.location.href and location.reload

window location href and location reload() both redirects a page to a new page but there are some difference to follow. Here is the difference between window.location.href and location.reload: window.location.href is not a method. It is a property which will tell you the current URL location of the browser. Changing the value of the property […]

Categories
jQuery

Select an element with multiple classes in jQuery

The basic concept of jQuery is to select one or more elements using element ID, Class, Attribute, Compound CSS Selector and do something with them. Let’s see how to select an element with multiple classes. For simple selection you can use following code as below. Selecting Elements by ID: $( “#Id” ); Selecting Elements by […]

Categories
API

Google Charts – visualize data on your website

Google charts provides a better way to visualize website data on your website. The chart gallery provides a very large number of ready to use chart types from simple line charts to hierarchical tree maps. To integrate Google Charts you need to embed JavaScript in your webpage. The process is very simple. Just load Google […]

Categories
SEO

Leverage browser caching

Leverage browser caching is a process when webmaster has instructed the browsers how their resources should be dealt with. Basically, browser caching stores webpage resource files on your local computer when any user visits a webpage. When any webpage displays on a web browser then there are so many things to load i.e. logo, css […]

Categories
jQuery

Add table row dynamically in jQuery

Want to add an additional row to a table as the last row in jQuery? Use jQuery after() method to add table row dynamically after last row. You can include anything within the after() method and this is a valid HTML, including multiple rows as per the example below: Example to add table row dynamically: […]

Categories
jQuery

How to check checkbox with jQuery?

The correct way to check checkbox on the DOM elements can be done using jQuery .prop or .attr method. By using JavaScript’s “checked” property, we can solve the problem directly, instead of manipulating the DOM into doing what we want it to do. To check checkbox see the below script: After jQuery version 1.6 you […]

Categories
Css

Disable text selection highlighting using CSS rule

There is a CSS standard way by which you can disable the highlighting effect i.e. disable text selection when you select any text. This can be done using JavaScript but using CSS you can achieve this also. <style type=”text/css”> .disableselect { user-select: none; -ms-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } </style> […]

Categories
jQuery

Difference between toArray and makeArray in jquery

jQuery toArray and makeArray both are the useful function to build with the transforming. The jQuery toArray() transforms jQuery element set to javaScript Array, jQuery.makeArray() transforms any array like object to JavaScript Array. Let’s see the difference between toArray and makeArray in jQuery. The jQuery toArray() method returns the elements contained in the jQuery selector […]