jquery Disable a tag, jquery disable button click

Source: Internet
Author: User

JqueryDisable A-label Method 1
$ (document). Ready (function () {$ ("a"). each (function () {varTextValue = $ ( This). html (); if(TextValue = ="XX Overview"|| TextValue = ="Service Navigation") {                $( This). CSS ("cursor","default"); $( This). attr ('href','#');//Modify the HREF attribute value of <a> to # so the status bar does not show the link address$( This). Click (Function (Event) {                    Event. Preventdefault ();//if <a> defines the target= "_blank" need this sentence to prevent the opening of a new page                }); }        });});
JqueryDisable A-label Method 2
$ ('a.tooltip'). Live ('click', function (event) {   alert (" Sorry, deactivated! ");     Event . Preventdefault ();   });
jquery Disable A-label Method 3
$ (function () {$ ('. Disablecss'). Removeattr ('href' ) ); // Remove the href attribute in the A tag $ ('. Disablecss'). Removeattr ('onclick  '); // Remove the onclick event from the A tag });
The jquery control button is disabled and enabled
$ ('#button'). attr ('disabled',"true  "); Add the Disabled property $ ('#button'). Removeattr ("  Disabled"); Remove Disabled property

jquery Disable a tag, jquery disable button click

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.