disable button in jquery in javascript

You can disable a button using jQuery by using the prop() method to set the disabled attribute to true.

Here's an example that disables a button with the ID myButton using jQuery:

index.tsx
$("#myButton").prop("disabled", true);
39 chars
2 lines

And if you want to re-enable the button:

index.tsx
$("#myButton").prop("disabled", false);
40 chars
2 lines

Remember to replace #myButton with the actual ID of the button you want to disable.

related categories

gistlibby LogSnag