+ 1

using progress tag and input tag together?

How to write a program where we can use input value as the progress value??

7th Jul 2020, 8:20 AM
C Alpha Beraka
C Alpha Beraka - avatar
10 Answers
+ 1
Assuming you have the following in the document: - progress - input (type -> text) - button (type -> button) * Add a "click" event listener for the button in the JS section. * Inside the event handler function you get the text input value. * Try to convert the text input value into an integer using parseInt() or Number(). * If the conversion succeeded and you have a valid integer (not a NaN), then use the integer as the value for progress element's "value" attribute. (Edit) You can opt to use input (type -> number) to minimize possibilty of invalid input.
7th Jul 2020, 9:51 AM
Ipang
+ 1
thanks... 😇
7th Jul 2020, 1:17 PM
C Alpha Beraka
C Alpha Beraka - avatar
+ 1
How's it going? did you make it? And of course, you're welcome 👌
7th Jul 2020, 1:36 PM
Ipang
+ 1
Do like this instead ... var x = document.getElementById("demo"); x.value = 50; // <- no double quotes You can also use the variable converted from text input in place of 50 there ... x.value = <the-variable>; Something like that ...
7th Jul 2020, 1:48 PM
Ipang
+ 1
No problem 👌
7th Jul 2020, 2:23 PM
Ipang
0
How can i give progress value from javascript command???
7th Jul 2020, 1:39 PM
C Alpha Beraka
C Alpha Beraka - avatar
0
<progress min ="0" max ="100" value =" " id =" demo "> <script > var x=document.getElementById (" demo "). value; x="50";
7th Jul 2020, 1:41 PM
C Alpha Beraka
C Alpha Beraka - avatar
0
Is this right??
7th Jul 2020, 1:41 PM
C Alpha Beraka
C Alpha Beraka - avatar
0
Ok 😇..... Sir...
7th Jul 2020, 1:55 PM
C Alpha Beraka
C Alpha Beraka - avatar
0
It worked Thnkuu sir... 🙏
7th Jul 2020, 2:21 PM
C Alpha Beraka
C Alpha Beraka - avatar