-4

I have span code:

<span style="width: 93%;">
    <b>93%</b>
<span>

Span have percentage value. I need javascript code when I change this span value below 50% it will show

<p>
    Task completed in **[percent value from span here]**
</p>

else

show this text and hide 2 classes (progress bar and image)

<p>
    **[percent value from span here]** left to complete the task
</p>

Thanks you a lot!

Uuuuuumm
  • 608
  • 5
  • 21
  • 1
    You should show us what you've done until now. StackOverflow will not give you a complete code, only help you to solve a problem or answer a real question – D. Schreier Feb 24 '20 at 21:04
  • if it is only about the text from you b tag, then texContent should do the job to start from. Adding data-attribute can be used to fill pseudo-elements . removed % from the value for an easy demo : https://codepen.io/gc-nomade/pen/WNvRzMX This is of course not your answer since your question is too broad , missing most of your relevant code to demonstrate your issue. – G-Cyrillus Feb 24 '20 at 21:34

1 Answers1

0

If you are looking for a way to alter CSS or show an hide based on the span value, onchange will be the way to go. This specific part for span with onchange is covered in the following thread: Trigger for span text/html on changed

Wael Hassan
  • 11
  • 1
  • 2