All jQuery Tips

jQuery – Page Redirect after X seconds wait

You must have come across any website which uses a webpage with some annoying advertisement and a message that says "You will be redirected to actual page after X seconds". This can be easily implemented with jQuery. In this post, find jQuery code to redirect user to another webpage after specific time interval or few […]
Read the rest of this entry »

Difference Between jQuery().each() and jQuery.each()

jQuery has 2 different methods jQuery().each() (Also written as "$.each()") and jQuery.each(). Both the methods are similar in nature used for iteration or looping but the differ only at the level where they are used. jQuery.each(): is used to iterate, exclusively, over a jQuery object. When called it iterates over the DOM elements that are […]
Read the rest of this entry »

jQuery: Select all readonly input type textbox

In this short post, find jQuery code to select all readonly input type textboxes present on the page. $(function(){ $(":input[type=text][readonly='readonly']").val(""); }); However, if you have single readonly textbox element, then select it using its ID. And if you want to exclude all readonly input type textboxes from selection, then use below jQuery code. $(function(){ $(":input[type=text]:not([readonly='readonly'])").val(""); […]
Read the rest of this entry »

jQuery: How to Strip/Remove HTML tags

In this short post, find jQuery code to strip/remove HTML tags. To remove HTML tags, use text() function which returns only the text content and ignores the HTML portion. console.log($('#dvTest').text()); You can also strip/remove HTML tags from any variable as well as text() is jQuery function, so the variable needs to be converted into a […]
Read the rest of this entry »

Use protocol less URL for referencing jQuery

Learnt something new today and thought of sharing. Most of us, include the reference of jQuery library (if Google CDN is used) like this, http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js As you can see it is using HTTP protocol. The advantage of Google CDN files are cached up to one year which means that your users may not need to […]
Read the rest of this entry »

Ignored powerful shortcuts of jQuery

Many developers ignore shortcuts and power of jQuery and I myself being a victim of some of the useful, handy but yet ignored shortcuts of jQuery. These are not some advance or complex shortcuts but I guess these are used a lot. Consider, below jQuery code lines. $("#elm").css("display", "none"); //Line 1 $("#elm").css("display", ""); //Line 2 […]
Read the rest of this entry »