How to enble/disable a button in TypeScript 1.5?

There should be a cleaner way to do this:

var element = <HTMLInputElement> document.getElementById("btnExcel");
element.disabled = true;

Or if you prefer a one liner:

(<HTMLInputElement> document.getElementById("btnExcel")).disabled = true;

It seems getElementById and the like should be a generic method and accept a type parameter. That said, a generic method wouldn’t give you anything that typecasting doesn’t.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)