Home > database >  Insert a getElementById inside a progress bar value=""
Insert a getElementById inside a progress bar value=""

Time:11-02

How can i add the result of this simple script in a value="" of a progress bar?

<script>
document.getElementById("demo").innerHTML = (100   50) * 3;
</script>

Like this

<progress ... value="document.getElementById('demo')">

Thanks

enter image description here

CodePudding user response:

<script>
var progress = (100   50) * 3;
document.getElementById("demo").innerHTML = progress;
document.getElementById("progress").value = progress;
</script>
.
.
.
<body>
<progress id='progress'>
</body>

CodePudding user response:

You'll need to use JavaScript to set its value property:

<div id="demo"></div>
<progress max="10">
<script>
document.getElementById("demo").innerHTML = document.querySelector('progress').value = 7;
</script>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

With a meter tag:

<meter min="28900" max="31100" value="30000">
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related