Why can't I disable the click function when I add the disabled class name to the Li tag? This is not set in the bootstrap.js, okay?

Source: Internet
Author: User

<input class= "disabled" > does not disable the default behavior of the button

<input disabled= "disabled" > can suppress the default behavior of an element

jquery or JS

Class= "disabled" element is not clicked

Like what
<a id= "postcomment" class= "btn" > Submit </a> Click Effective
<a id= "postcomment" class= "btn disabled" > Submit </a> Click Invalid

Thank you!

1 eg 2 <ul>3                 class= "disable" > Announcements </a></li>4                 <li ><a href= "#"class= "disable" > Rules </a></li>5                 <li><a href= "#" class= "disable" > Forum </a></li>6                 <li><a href= "#" > Security </a> </li>7                 <li><a href= "#" > Public Welfare </a></li>8 </ul>

As long as the normal bootstrap, non-custom ... Introduce disable class can!!

For the disabled style in bootstrap, it does not seem that the default behavior of the A tag is handled, which is probably why it can still be triggered, although it has a disabled style set.

Solution:

1. Add CSS to prevent the triggering of a tag

1 . disabled{2 pointer-events:3 }
1 <!--prohibited status--2class= "pager" >3   class= "disabled" > <a href= "http://v3.bootcss.com/" >&laquo; previous </a></li>4   <li><a href = "#" > Next &raquo;</a></li>5 </ul>

2. JQ

1            $ (". disabled"). Click (function  (event) {2                event.  Preventdefault ();         3                   });

  

Why can't I disable the click function when I add the disabled class name to the Li tag? This is not set in the bootstrap.js, okay?

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.