How to assign variable to html input
P粉008829791
P粉008829791 2024-02-04 10:29:30
0
1
602

I want to assign a variable to the html input. This is what I tried but it doesn't work.

<input type=number>let x = 10</input>

I want to assign a variable to the html input so that I can use it later, how can I do this.

P粉008829791
P粉008829791

reply all(1)
P粉302160436

Get the input element in js and assign it a value like this

const input = document.querySelector("input");
let x = 10;
input.value = x;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template