DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

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

jQuery tips and tricks

Share

In this article you will learn about few jQuery tips and tricks of interesting. Until you practice, you will not be able to be master of jQuery.

jQuery tips:

To check if checkbox is checked:

 if ($("#checkID").is(':checked')) {
 ...
 }

or

 if ($('#checkID').attr('checked')) {
 ...
 }

Check whether an element exists or not:

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

Block mouse right click:

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

Whether an element is visible or not:

 $("#myDIV").is(":visible");

To get the size of the element:

 $('element').length

Scroll the page to the div ID:

 $(document).scrollTop($('#myDIV').offset().top);

Replace an element by another:

 $("#oldID").replaceWith("<span>New content goes here...</span>");

Find an element by CSS class:

 $('body').find('.myclass');

Document.ready:

 $(document).ready(function() {
 ....
 });

Window resize:

 $(window).resize(function(){
 ...
 });

Find an element by attribute:

 $('#myDIV').find('span[class="sp"]').hide();
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.

Recent Posts

Small Personal Touches That Make a Golf Day More Enjoyable

Golf is often described as a game of patience, practice, and precision. That is true,…

2 days ago

How Western Tech Companies Can Hire the Right IT Project Managers in Hong Kong?

Introduction: Hiring IT Project Managers in Hong Kong Entering a new industry provides interesting chances,…

3 days ago

Integrating Web Apps with Enterprise CRMs

Modern web applications rarely live alone. A customer portal, an internal order-management console, or a…

1 week ago

The Invoice Arrived. Who Approved the Purchase?

An invoice lands in the accounts inbox for equipment delivered three weeks ago. The supplier…

1 week ago

5 UI/UX Design Tweaks That Instantly Boost Google Ads Conversion Rates

A Google Ads management campaign can look healthy in the dashboard and still waste money…

2 weeks ago

Before You Buy More Traffic, Fix the Questions Your Website Leaves Unanswered

A potential customer arrives on your website after searching for a service you provide. They…

2 weeks ago