Category: jQuery

Password Strength

$(‘#pass’).keyup(function(e) { var strongRegex = new RegExp(“^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$”, “g”); var mediumRegex = new RegExp(“^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$”, “g”); var enoughRegex = new RegExp(“(?=.{6,}).*”, “g”); if (false == enoughRegex.test($(this).val())) { $(‘#passstrength’).html(‘More Characters’); } else if (strongRegex.test($(this).val())) { $(‘#passstrength’).className =...

Image Preloader

Very easy way to preload images which are needed later (e.g. when a hover is performed) <script type=”text/javascript”> $.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { $(“<img />”).attr(“src”, arguments[i]); } }...

Exclude $(this) from Selector

Let’s say you want to attach a click handler to every link on a page. The function for that click handler turns all the other links a different color var $allLinks = $(“a”); $allLinks.click(function() { $allLinks.not(this).css(“color”,...

Top 10+ jQuery Popup window plugins

. 1. Speedo Popup jQuery Plugin Speedo Popup is a powerful popup / modal plugin. It`s fully RESPONSIVE and is designed to provide an optimal viewing experience. Also has compatibility for HTML5 and CSS3 and...

Common jQuery Mistakes

I have listed down 10 common jQuery mistakes from my personal experience and their fixes that you might be also doing while writing jQuery code.   1. Be courageous to remove jQuery Sometimes things can be...

How to use jQuery setTimeout function

The Basic syntax for setTimeout function is, 1 setTimeout(function() { 2       // Do something after 2 seconds 3 }, 2000); The setTimeout function takes the times in miliseconds. And the block can contain either yourjQuery code, or...

Writing your first jQuery Mobile app

Before we begin, its important to know “What is jQuery Mobile”? Well, jQuery mobile is a framework created for making platform independent mobile applications. It is built using HTML5, CSS3, and the very popular jQuery...

Creating Dialog Box in jQuery Mobile – Part 1

Let’s begin Any page in jQuery mobile can be created as dialog box. All you need to do is to apply data-rel=”dialog” attribute to the to the page anchor link and jQuery mobile will do the...

Latest jQuery interview questions and answers 04

Q31. How do you check if an element is empty? Ans: There are 2 ways to check if element is empty or not. We can check using “:empty” selector. 1 $(document).ready(function(){ 2     if ($(‘#element’).is(‘:empty’)){ 3...

Latest jQuery interview questions and answers 01

Below is the list of latest and updated jQuery interview questions and their answers for freshers as well as experienced users. These interview question covers latest version of jQuery which is jQuery 2.0. These interview...

When can you use jQuery?

apply CSS call functions on events traverse the documents manipulation purpose and to add effects too.

Explain how jQuery Works?

<html> <head> <script type=”text/javascript” src=”jquery.js”></script> <script type=”text/javascript”> // You can write the code here </script> </head> <body> <a href=”http://www.globalguideline.com/”>Global GuideLine</a> </body> </html>

Why is jQuery better than JavaScript?

Ans. * jQuery is great library for developing ajax based application. * It helps the programmers to keep code simple and concise and reusable. * jQuery library simplifies the process of traversal of HTML DOM...

what is jQuery connect?

Ans. It is a jquery plugin which enables us to connect a function to another function. It is like assigning a handler for another function. This situation happens when you are using any javascript plugins...

Can you give me a brief history of your programming days?

Ans. Although it’s a bit embarrassing, my first programming experience was trying to build a customized and skinnable mediaplayer with Visual Basic 6. This probably was around 1999 or so, and although the media player...

How to use jQuery library in our ASP.Net project?

Ans. Download the latest jQuery library from jQuery.com and include the reference to the jQuery library file in our ASPX page. <script src=”_scripts/jQuery-1.2.6.js” type=”text/javascript”></script> <script language=”javascript”> $(document).ready(function() { alert(‘test’); }); </script>

Swapping Out Text, Five Different Ways

It’s a common need in web apps: you click something and the text of the thing you just clicked changes. Perhaps something simple like a “Show” button that swaps to “Hide”, or “Expand Description”...

The Use of jQuery in Tutorials

I Write What I Do This blog is a reflection of things that I learn. I use jQuery a bunch. So when I translate things into a tutorial, I do it how I would...

jQuery – Get Content and Attributes

jQuery contains powerful methods for changing and manipulating HTML elements and attributes. jQuery DOM Manipulation One very important part of jQuery is the possibility to manipulate the DOM. jQuery comes with a bunch of...

jQuery – Chaining

With jQuery, you can chain together actions/methods. Chaining allows us to run multiple jQuery methods (on the same element) within a single statement. jQuery Method Chaining Until now we have been writing jQuery statements...

jQuery Callback Functions

A callback function is executed after the current effect is 100% finished. jQuery Callback Functions JavaScript statements are executed line by line. However, with effects, the next line of code can be run even...

jQuery Stop Animations

jQuery stop() Method The jQuery stop() method is used to stop an animation or effect before it is finished. The stop() method works for all jQuery effect functions, including sliding, fading and custom animations....

jQuery Effects – Animation

jQuery Animations – The animate() Method The jQuery animate() method is used to create custom animations. Syntax: $(selector).animate({params},speed,callback); The required params parameter defines the CSS properties to be animated. The optional speed parameter specifies...

jQuery Effects – Fading

jQuery Fading Methods With jQuery you can fade an element in and out of visibility. jQuery has the following fade methods: fadeIn() fadeOut() fadeToggle() fadeTo() jQuery fadeIn() Method The jQuery fadeIn() method is used...

jQuery hide() and show()

With jQuery, you can hide and show HTML elements with the hide() and show() methods: Example $(“#hide”).click(function(){ $(“p”).hide(); }); $(“#show”).click(function(){ $(“p”).show(); }); Syntax: $(selector).hide(speed,callback); $(selector).show(speed,callback); The optional speed parameter specifies the speed of the...