Category Archives: jquery – lib

Dimensions of jQuery

jQuery provides various methods to get and set the CSS dimensions for the various properties. Following diagram explains how various dimensions (width, height, innerWidth, innerHeight, outerWidth, outerHeight) can be depicted for any HTML element: jQuery Dimension Methods Following are the methods to manipulate CSS dimensions for the various properties of the HTML elements. width() – This… Read More »

CSS Classes in jQuery

jQuery provides three methods addClass(), removeClass() and toggleClass() to manipulate CSS classes of the elements. We have divided our CSS manipulation discussion into two parts. This chapter will discuss about manipulating CSS classes and the next chapter will discuss about manipulating CSS properties. jQuery – Adding CSS Classes jQuery provides addClass() method to add a CSS class to the matched HTML element(s).… Read More »

How to Replace Elements in jQuery

jQuery provides replaceWith() method to replace existing HTML content with a new content in a given HTML document. jQuery replaceWith() Method The jQuery replaceWith() method removes the content from the DOM and inserts a new content in it’s place. Following is the syntax of the replaceWith() method: $(selector).replaceWith(newContent); The replaceWith() method removes all data and event handlers associated with the removed… Read More »

How to Remove Elements in jQuery

jQuery provides remove() and empty() methods to remove existing HTML elements from an HTML document. jQuery remove() Method The jQuery remove() method removes the selected element(s) and it’s child elements from the document. Following is the syntax of the remove() method: $(selector).remove(); You should use remove() method when you want to remove the element itself, as well as everything inside it. Synopsis Consider the following… Read More »

How to Add Elements in jQuery

jQuery provides various methods to add new DOM elements in the existing HTML document. You can add these new elements at various locations (before, after any of the existing tags) based on your requirements. jQuery append() Method The jQuery append() method adds the content at the end of the matched each element(s). You can also append multiple… Read More »

DOM Manipulation in jQuery

jQuery provides a number of methods to manipulate DOM in efficient way. You do not need to write big and complex code to set or get the content of any HTML element. jQuery DOM Manipulation jQuery provides methods such as attr(), html(), text() and val() which act as getters and setters to manipulate the content from HTML documents. Document Object Model… Read More »

Use Of Ajax in jQuery

AJAX is an acronym standing for Asynchronous JavaScript and XML and this technology helps us to load data from the server without a browser page refresh. If you are new with AJAX, I would recommend you go through our Ajax Tutorial before proceeding further. JQuery is a great tool which provides a rich set of AJAX methods… Read More »

jQuery Attributes Manipulation

jQuery is being heavily used in manipulating various attributes associated with HTML elements. Every HTML element can have various standard and custom attributes (i.e. properties) which are used to define the characteristics of that HTML element. jQuery gives us the means to easily manipulate (Get and Set) an element’s attributes. First let’s try to understand… Read More »

Event Handling in jQuery

Any modern web application can’t be imagined without an event associated with it. Events are the mechanism to build an interactive web page. jQuery is smart enough to handle any event generated on an HTML page. First let’s try to understand what is an event. What are jQuery Events? A jQuery Event is the result… Read More »

Use of Selector in jQuery

The most important functionality of jQuery is provided by it’s Selectors. This tutorial will explain jQuery Selectors with simple examples covering all the three standard selectors. jQuery Selectors jQuery Selectors are used to select HTML element(s) from an HTML document. Consider an HTML document is given and you need to select all the <div> from this document. This… Read More »