How to Disable or Renable a Button in Javascript Using jQuery Library (PROP + ATTR) Methods Full Tutorial For Beginners

How to Disable or Renable a Button in Javascript Using jQuery Library (PROP + ATTR) Methods Full Tutorial For Beginners

 

Welcome folks today in this post we will be talking about how to disable or renable a button in javascript using popular library called as jquery. All the code snippets used will be given below.

 

 

 

Disabling a Button in jQuery

 

 

Now to disable a button using jquery we will use the typical method of jquery called as attr to disable or renable a button

See also  JavaScript Program to Convert Decimal to Binary in Browser Full Project For Beginners

 

 

$("#button").attr("disabled","true")

 

 

 

Renable Button in jQuery

 

 

Now renabling a button is very easy you just need to do the opposite

 

 

$("#button").attr("disabled","false")

 

 

 

Second Method to Disable or Renable a Button

 

See also  Build Google Drive API File Direct Download Link Generator Tool in Browser Using HTML5 & Javascript Full Project For Beginners

 

We can also use prop method in jquery to do the same thing

 

 

$("#button").prop("disabled","true")

 

 

$("#button").prop("disabled","false")

 

 

 

Leave a Reply