All jQuery Codes

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 »

jQuery to redirect page after specific time interval

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 »

Check for ‘#’ hash in URL using jQuery

In this short post, find jQuery code to check if URL contains "#" (hash) or not. This can be checked via location.hash property provided by JavaScript and same can be used in jQuery. $(document).ready(function(){ if(window.location.hash) { // # exists in URL } else { // No # in URL. } }); Feel free to contact […]
Read the rest of this entry »

Get Client IP address using jQuery

In this post, find jQuery code to get Client's IP address. There are 2 free online services which allows you to get Client IP address. 1. jsonip.com: is a free utility service that returns a client's IP address in a JSON object with support for JSONP, CORS, and direct requests. It serves millions of requests […]
Read the rest of this entry »

Scroll Page Automatically by few pixels after every few seconds using jQuery

It would be nice feature for web pages if the web page scrolls automatically by few pixels after every 2, 3 or 5 seconds so that the users don't have to scroll it. This is quite useful for webpages having articles, posts, very long text or lengthy pages. So, In this post you will find […]
Read the rest of this entry »

Responsive Menu
Add more content here...