I'm new to JavaScript and I decided to write a calculator but It doesn't work and I know it's correct it's not related to the code or maybe it is idk. but over 90% sure that the problem is not the code cause I wrote the same code on the internet. I tried to write it in an external JS file so I wanted to paste it here like this that u won't get bothered. thanks...
let result = document.querySelector('.result');
function sum() {
let num1 = document.querySelector('.num1');
let num2 = document.querySelector('.num2');
let num1 = parseInt(num1);
let num2 = parseInt(num2);
let submit = num1 + num2;
result.textContent = submit;
}
<label for="num1">Number 1 : </label>
<input type="number" class="num1" /><br><br>
<label for="num2">Number 2 : </label>
<input type="number" class="num2" /><br><br>
<input type="button" style="margin-left: 10px;" value="Submit" onclick="sum()"></button><br><br>
<label for="result">Result : </label>
<h1 class="result" />dd</h1>
let. If you would check the console, you would see that error.document.querySelector('.result').value;I see you are really professional you show me the way only with in sentence. thanks