Categories
jQuery

Check parent checkboxes in nested ul li – jQuery

Sometimes in jQuery we need to select all checkbox that are child of a element or depends on child checkbox we need to select top most parent checkbox. You need to iterate all children for which the parent you click in and the same way for a child we need to check top most parent. […]

Categories
jQuery

jQuery AJAX Methods

AJAX is an acronym standing for Asynchronous JavaScript and XML that is the art of exchanging data with a server without a browser page refresh. jQuery is a great tool that provides a set of AJAX methods to develop the next generation of web application. This jQuery method is mostly used for requests where the […]

Categories
jQuery

jQuery live() Method

The jQuery live method attach one or more event handlers for all elements which match the current selector and specifies a function to run when the events occur. Event handlers attached using live() method works for both current and future elements which match the selector. Syntax of jQuery live(): $(selector).live(event, data, function) Note: The jQuery […]

Categories
jQuery

Encode a set of form elements as a string

The serialize() method creates a text string in standard URL-encoded notation by serializing form values. One or more form elements (input, radio, checkbox etc.) can be used as a serializing. You can use this serialized values as a URL query string while making an AJAX request. Syntax: $(selector).serialize() Below we have shown an example for […]

Categories
jQuery

jQuery Data Method

jQuery data method gives you the ability to associate arbitrary data with HTML DOM nodes and JavaScript objects. As of jQuery 1.4.3, you have the ability to use this method on JavaScript objects and call for element modification. jQuery.data() method store arbitrary data associated with the specified element or returns the value that was set. […]

Categories
jQuery

jQuery bind() and unbind() – attaching event handlers

jQuery bind() function is used to attach one or more event handler to elements, while the unbind() is used to removes an existing event handler from elements. As of jQuery version 1.7, jQuery on() method is the preferred method rather than jquery bind and unbind for attaching event handlers for selected elements. bind() : A basic […]

Categories
jQuery

jQuery scroll to element

Sometimes it is required in our website to move the page scroll to any jQuery/DOM element position for a reason like clicking on anchor move the scroll to div element. Here’s how you can programmatically scroll to any element on the top of the page. If you’re using jQuery then, you don’t need any plugin. […]

Categories
jQuery

Using Delegate and Undelegate in jQuery

Using delegate and undelegate in jQuery, you can bind or remove a handler from the event for all elements that matches the current selector. Basically, these methods achieve the same thing as the jQuery .live() and .die() methods but they just use a different syntax. Syntax of Delegate: $(selector).delegate(childSelector,event,data,function) Example of jQuery Delegate: $(“table”).delegate(“td”, “hover”, […]

Categories
jQuery

Autosize: dynamic textarea sizing plugin

Autosize is a small jQuery plugin that allow textarea autosize making height dynamically so that it expands as based on visitor input. You can implement textarea autosize by calling the .autosize() method on any textarea element. Example of textarea autosize: $(‘textarea’).autosize(); For implementation autosize in your website you need to follow below steps: Include jQuery […]

Categories
jQuery

Include multiple js files using jQuery $.getScript() method

The jQuery getScript() method is used to Include multiple js files i.e. load and execute a JavaScript from the server using an AJAX HTTP GET request. The method returns XMLHttpRequest object and the callback is fired once the script has been loaded, but not necessarily executed. Syntax of getScript: $(selector).getScript(url,success(response,status)) $.getScript( “test.js”, function( data, textStatus, […]