Typescript Complains About Htmlelement Do Not Have Value Property
TypeScript complains about HTMLElement do not have value property but when I use it in JavaScript it works fine. var inputValue: HTMLElement = document.getElementById('input1');
Solution 1:
HTMLElement doesn't have the value
member, the HTMLInputElement does.
You need to type assert it:
var inputValue = document.getElementById('input1') asHTMLInputElement;
console.log(inputValue.value); // should be ok
Edit
The typescript definitions represent actual javascript dom elements, in this case for HTMLElement and HTMLInputElement.
Post a Comment for "Typescript Complains About Htmlelement Do Not Have Value Property"