0

I need to check the value inside a div. This is found on an online monitoring site. Essentially the aim would be to receive a notification/mail in case there are any changes. Ex: the value is 0 (no problems) most of the time. if it changes to 1 or more i need to save that value and send a notification. The notification part is not a problem, but for reading the values ​​i have no ideas.

Example of the value to read at 0

<div class="disaster-bg">
  <span class="count">0</span> 
Disaster</div>

It's my first question on this site, so if i didn't follow some kind of rules, please tell me. Honestly I don't even know what language to use if like php or javascript or both or whatever. I never worked on an online site that i also didn't have locally so i'm kinda lost in this situation.

Carsten Løvbo Andersen
  • 26,637
  • 10
  • 47
  • 77
  • this [answer](https://stackoverflow.com/questions/6743912/how-to-get-the-pure-text-without-html-element-using-javascript) might help. – Layhout Apr 24 '23 at 07:20
  • 1
    you need a front end and a backend language. The frontend needs to do the check with JS. Then send the information to the backend such as PHP as the frontend cannot send emails. – tacoshy Apr 24 '23 at 07:30
  • 1
    @tacoshy _"The frontend needs to do the check with JS."_ - that would only work if they are in control of the site, but to me it sounds like they want to extract this info from some external tool here. – CBroe Apr 24 '23 at 08:07
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Yogendra Apr 24 '23 at 08:57
  • 1
    The question is unfortunately a bit too unfocused. To point you in the right direction though, what you're looking for is called [Web Scraping](https://en.wikipedia.org/wiki/Web_scraping) and can be done with most languages. There are a lot of articles/guides etc out there about the subject. – M. Eriksson Apr 24 '23 at 09:07

1 Answers1

0

you can consider an id for that specific element, and then read it's value via javascript.

like this:

HTML:

        <span class="count" id="count">0</span> 
      Disaster</div>

JS:

let count = document.getElementById("count").outerText;