+ 1
using progress tag and input tag together?
How to write a program where we can use input value as the progress value??
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.
+ 1
thanks... đ
+ 1
How's it going? did you make it?
And of course, you're welcome đ
+ 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 ...
+ 1
No problem đ
0
How can i give progress value from javascript command???
0
<progress min ="0" max ="100" value =" " id =" demo ">
<script >
var x=document.getElementById (" demo "). value;
x="50";
0
Is this right??
0
Ok đ..... Sir...
0
It worked Thnkuu sir... đ