0

I'm trying to make html page with three items on it. There are input, button and tag p like output on the page.

<head>
    <meta charset="utf-8">
    <title>input output</title>
    <script text="text/javascript"src="./scripts/Calc.js"></script>
</head>
<body>
        <form>
          <input type="text" placeholder="0,00" name="mpminput" id="mi">
          <button type="submit" onclick="mpmInput()">Enter</button>
          <p id="oq"></p>
        </form>
    </section>
</body>

And javascript file

let mpmi;
function mpmInput() {
    mpmi = document.getElementById("mi").value;
    document.getElementById("oq").innerHTML=mpmi;
}

I want to see the number which I entered in the input field. It works partly. When I pressed button the number appears but quickly disappears after that. I work in trebedit ide on the tablet. It has own browser. I can open this page in the chrome. But browser after pressing button gives me the message "the file could not be accessed" err_file_not_found. How can I fix this problem?

  • Try changing the button type from "submit" to just "button". A submit button will send the form to the server and refresh the page, which is not what you want in this case. – Yogi Oct 09 '22 at 17:31
  • Does this answer your question? [How can I prevent refresh of page when button inside form is clicked?](https://stackoverflow.com/questions/7803814/how-can-i-prevent-refresh-of-page-when-button-inside-form-is-clicked) – Yogi Oct 09 '22 at 17:39
  • Hi, thanks for the help. I'd changed the type of the button. Trebedit's browser behaving normally. But I don't see the number after pressing the button in the chrome. And it don't show me the message. – user17065575 Oct 12 '22 at 15:44
  • I understand, my page in chrome don't see the js file. – user17065575 Oct 12 '22 at 16:06

0 Answers0