Advertisement
nrzmalik

Update Progress Value

Jul 1st, 2023 (edited)
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.51 KB | Source Code | 0 0
  1. let player = GetPlayer();
  2. let Value = player.GetVar("Progress");
  3.  
  4. function updateProgressBar(newValue) {
  5.   // update the global 'value'
  6.   value = newValue;
  7.  
  8.   // get the progress bar and text elements
  9.   let progressbar = document.getElementById('progressbar');
  10.   let progressText = document.querySelector('#progressContainer div:last-child');
  11.  
  12.   // update the progress bar width and text
  13.   progressbar.style.width = value + '%';
  14.   progressText.innerHTML = value + '% Completed';
  15. }
  16. updateProgressBar(Value);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement