Codey93 Codey93 - 8 months ago 29
HTML Question

Javascript, div on click multiple numbers in input field

I'm trying to create a

to modify the number in my input field.


<input value="0">

And then a simple button or div with a
click function.

<button>Add +10</button>

After clicking on the button:

<input value="10">

Does someone have a place I can read and learn to create this, or any tips to get me started. I know very little
, but I wish to learn.


You can try this

<input value="0" id="id">

give a id to input field

on button click call a function

<button onclick="myFunction()">Add +10</button>

    function myFunction() {
        document.getElementById("id").value = parseInt(document.getElementById("id").value) +10;