Share 12 useful jQuery code snippets _ jquery-js tutorials

Source: Internet
Author: User
This article mainly introduces 12 practical jQuery code snippets, this article provides some useful code snippets, such as opening links in a new window, setting high columns, pre-loading images with jQuery, right-clicking disabled, and setting timers, for more information, see jQuery, an excellent JavaScript library. It is well known among WEB developers and WEB designers. It helps WEB designers develop many creative and beautiful WEB pages.

This article mainly shares 12 useful jQuery techniques. The specific content is as follows:

Below are some tips I have collected. These tips will help you improve the creativity and functionality of your website layout and application.

1. Open the link in a new window

With this code, When you click a hypertext link, it will be opened in a new window, providing a better user experience:

$(document).ready(function() { //select all anchor tags that have http in the href //and apply the target=_blank $("a[href^='http']").attr('target','_blank');}); 

Ii. Set the timer

$(document).ready(function() { window.setTimeout(function() { // some code }, 500);});

3. Set high Columns

Use the following code to make each column of Your webpage application have the same height:

First Line

Second Line

Third Line

Column Two

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.