Number from input box Javascript

后端 未结 4 502
没有蜡笔的小新
没有蜡笔的小新 2021-01-28 12:02

I\'m trying to get a number from an input box, but it returns an empty string as an alert. What do I miss?

4条回答
  •  走了就别回头了
    2021-01-28 12:53

    You read the value of the input as the page loads (when it has its default value, which is an empty string).

    You then alert the results of that read when the function runs.

    You need to read the value inside the function so that you get the value at the time the function runs.

提交回复
热议问题