Total Page Preview: 000000000168
How do you disable elements in Jquery Using "attr"?
Disable elements in Jquery Using "attr"
To disable an element using jQuery and the attr method, you can set the disabled attribute to true. Here's an example:
In this code snippet, the attr() method is used to set the disabled attribute to true, effectively disabling the button.
Keep in mind that the attr method was the standard way to manipulate attributes before jQuery 1.6. If you're using a newer version of jQuery, you might consider using the prop method instead, which is the preferred way to manipulate properties such as disabled:
Using prop is preferred because it works better for properties that can change, while attr is better for setting initial values or static attributes.
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com