DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
jQuery

Skilful act jQuery tips and tricks

Share

jQuery is a JavaScript library which is simple, light-weight, open source, cross browser and simplifies animations, event handling, and developing Ajax-based web applications and promotes rapid application development.

Here are few jQuery tips:

Check Element Exists

if ($("#element").length)
{ 
...
}

Check Element Is Visible

if($("#element").is(":visible") == "true")
{ 
...
}

Disable Right Mouse Click

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

Current Mouse Coordinates

$(document).ready(function() {
    $().mousemove(function(e)
    {
    $('#mouseDiv ').html("X Axis = " + e.pageX + " and Y Axis = " + e.pageY);
    });
});
<DIV id=mouseDiv></DIV>

Determine Browser

$(document).ready(function() {
// If the browser type is Mozilla Firefox
if ($.browser.mozilla && $.browser.version >= "1.8" ){ 
// some code
}
// If the browser type is Opera
if( $.browser.opera)
{
// some code
}
// If the web browser type is Safari
if( $.browser.safari )
{
// some code
}
// If the web browser type is Chrome
if( $.browser.chrome)
{
// some code
}
// If the web browser type is Internet Explorer
if ($.browser.msie && $.browser.version <= 6 )
{
// some code
}
//If the web browser type is Internet Explorer 6 and above
if ($.browser.msie && $.browser.version > 6)
{
// some code
}
});

Chaining Feature

$(element).removeClass('Class1').addClass('Class2');
Namaste UI (Author)

Namaste UI collaborates closely with clients to develop tailored guest posting strategies that align with their unique goals and target audiences. Their commitment to delivering high-quality, niche-specific content ensures that each guest post not only meets but exceeds the expectations of both clients and the hosting platforms. Connect with us on social media for the latest updates on guest posting trends, outreach strategies, and digital marketing tips. For any types of guest posting services, contact us on info[at]namasteui.com.

View Comments

Recent Posts

Understanding Battery Coating: Key Factors to Perfection

Battery coating is the process of applying uniform layers of active materials—such as cathode and…

4 hours ago

Edge Computing vs Cloud Computing: What’s the Difference?

Let’s face it. Tech buzzwords get thrown around a lot—especially when it comes to how…

3 days ago

How Data Intelligence Shapes the Future of Digital Innovation

In today’s digital world, the boundaries between technology, finance, and innovation are rapidly disappearing. Businesses…

6 days ago

How To Power Your Backyard Parties with A Solar Power Battery?

Backyard gatherings like BBQs, family reunions, and garden parties are an exciting way to enjoy…

7 days ago

5 Best Practices for Programmatic Advertising

Marketers are always on the lookout for more effective ways to reach their target audiences.…

1 week ago

Are We All Addicted to Stimulation? The New Face of Anxiety Disorders

Does your phone control your mind more than you control your phone? Modern life exploits…

1 week ago