attr(“disabled”, false) causing error in Typescript

I have the following code in my ts file:

 $('input[type=hidden]').attr("disabled", false);

Code works but i am getting the following error:
Argument of type ‘false’ is not assignable to parameter of type ‘string | number | ((this: HTMLElement, index: number, attr: string) => string | number | void)’.

2 Answers

You should remove attribute altogether.

 $('input[type=hidden]').removeAttr("disabled");

Try to pass false as string.

 $('input[type=hidden]').attr("disabled", "false");

Archive from: https://stackoverflow.com/questions/59070182/attrdisabled-false-causing-error-in-typescript

Leave a Reply

Your email address will not be published. Required fields are marked *