0
function Sum() {
    var Number1 = 0, Number2 = 0, sum = 0;
    var input: HTMLInputElement;
    input = <HTMLInputElement>document.getElementById("txtNumber1");
    Number1 = parseFloat(input);
    input = <HTMLInputElement>document.getElementById("textNumber2");
    Number2 = parseFloat(input);
    sum = Number1 + Number2;
    var txtNumberSum: HTMLParagraphElement;
    var txtNumberSum = <HTMLParagraphElement>document.getElementById("txtNumberSum");
    txtNumberSum.innerHTML = sum;
}

TypeScipt Code

Error code's Argument of type 'HTMLInputElement' is not assignable to parameter of type 'string'

Type 'number' is not assignable to type 'string

html Code

Jacy
  • 9
  • 1
  • 2
    `parseFloat(input)` -> `parseFloat(input.value)` – VLAZ Jan 21 '21 at 15:32
  • 3
    Does this answer your question? [How do I get the value of text input field using JavaScript?](https://stackoverflow.com/questions/11563638/how-do-i-get-the-value-of-text-input-field-using-javascript) – VLAZ Jan 21 '21 at 15:33
  • ;==thx to a guy this works now parseFloat(input) -> parseFloat(input.value) but I still need this to work txtNumberSum.innerHTML = sum; its so i can bring the number back to my HTML and show it thx for helping – Jacy Jan 21 '21 at 16:59

0 Answers0