5 useful jquery tricks every web developer should know

jquery-logo

Hello developers.  We really find jquery  a good framework and find out really good tricks which every web developer should know.

Here is the list:

1. Disable right-click menu:

$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
});

.

2. Making your content Flash (Blink):

jQuery.fn.flash = function( color, duration )
{
    var current = this.css( 'color' );
    this.animate( { color: 'rgb(' + color + ')' }, duration / 2 );
    this.animate( { color: current }, duration / 2 );
}
 
$( '#someid' ).flash( '255,0,0', 1000 );

.

3. Document ready alternative:

$(function(){
	//document is ready do something
});

.

4. Detect Browser:

// Safari
if( $.browser.safari )
{
//do something
}
 
//Above IE6
if ($.browser.msie && $.browser.version > 6 )
{
//do something
}
 
// IE6 and below
if ($.browser.msie && $.browser.version <= 6 )  { //do something } // Firefox 2 and above if ($.browser.mozilla && $.browser.version >= "1.8" )
{
//do something
}

.

5. Check for Element existence:

if ($("#someDiv").length) {
    //yes it does ,do something
}

Thats it!!
Cheers!

Recently Published

»

5 Signs You Need a New Hosting Company

Web hosting has become cheaper and easier to attain than ever before. ...

»

5 Things to Consider When Designing A Logo For Your Startup

Designing a Logo is essential because it communicates your business. ...

»

What Is Access Control?

Access Control, When running a business, there are dozens of things ...

»

Process Management Solution For a Business

In order to be successful, a company needs to be on the same page and ...

»

5 Metrics You Should Track on Every Blog Post

As a blogger, you may have developed your blog with a variety of blog ...

»

3 of the Most Dynamic LMS Plugins for WordPress

The possibilities are limitless when you want to put a course online ...

»

Do You Really Need Access to Advanced Scripting Capabilities?

One of the features you’ll find most commonly advertised when ...

»

Obvious UX Trends that will Rule 2018

For web design industry, we see new UX trends in the way we build ...

»

Java Programming Language And Its Application

Programming language is one of the main IT developments of the past ...