Hello Fam Am a newbie am trying to get each input box seperately with js pls i need help

<!doctype html>
<html>
<head>
<title>
test
</title>
</head>
<body>
    <!-- <input type="number" value="1" id="demo"> -->
    <?php
      for ($i=0; $i <= 5 ; $i++) { 
       ?>
       Number <?php echo $i;?>: <input type="number" id="myNumber">
    <button onclick="myFunction()">Try it</button>
    <button onclick="myFunction1()">Try it</button><br>
       <?php
       # code...
      }
    ?>

    <script>
function myFunction() {
  document.getElementById("myNumber").stepUp();
}
function myFunction1() {
  document.getElementById("myNumber").stepDown();
}
</script>
</body>
</html>

All your inputs have the same ID. getElementByID() cannot distinguish between them.

I am not sure what you are trying to accomplish, pleas explain. You might need to use a different function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.