Disabled of prop & amp; attr in jquery

Source: Internet
Author: User

Disabled of prop & attr in jquery

I have encountered problems with prop & attr in checkBox before, so I was more cautious with using attr later. However, I encountered another problem when I recently used prop, as described below:

Scenario Description: this function can be used only when the transfer-out button is checked. Otherwise, it is in the gray-disabled state. What is the prZ used this time? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcLT6wuvI58/CPC9wPg0KPHByZSBjbGFzcz0 =" brush: java; ">$ (# SaleBtn). prop (disabled, disabled); // disable $ (# saleBtn). removeProp (disabled); // remove disabled

When I first came in to the page, disabling it worked. However, when I selected a quick redemption protocol and removed the selected protocol, the problem occurred and the above Code no longer worked, very strange.
There are five solutions to this problem:
Method 1:

$ (# SaleBtn). prop (disabled, true); // disable $ (# saleBtn). prop (disabled, false); // remove disabled

Method 2:

$ (# SaleBtn). prop (disabled, disabled); // disable $ (# saleBtn). prop (disabled,); // remove disabled

Method 3:

$ (# SaleBtn). attr (disabled, true); // disable $ (# saleBtn). attr (disabled, false); // remove disabled

Method 4:

$ (# SaleBtn). attr (disabled, disabled); // disable $ (# saleBtn). attr (disabled,); // remove disabled

Method 5:

$ (# SaleBtn). attr (disabled, disabled); // disable $ (# saleBtn). removeAttr (disabled); // remove disabled

 

Related Article

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.