what i am trying to achieve, is to look for text inside an element with the class .msg_counter and to hide the element, if the text is “0”.

The whole thing should be a live notification for incoming messages, so i want it to refresh the request all 10 seconds and play a sound, if there is change.

This is, what i have got so far:

jQuery('.msg_counter').each(function(i,el)
{
    var msg_counter = $(el);
    if(msg_counter.text() == 0)
        jQuery(this).prev().hide();
    else
        jQuery(this).prev().show();
});  

There seems to allready be an mistake inside this code and i am not realy sure, where it is.
If you can help me to find it and if you can give me some hints, how to achieve the “refresh and sound”-part, i would be glad.

Kind Regards
Dominik

Read more here: jQuery: Hide div, if containing text is 0, refresh every 10 seconds and play sound, if there is change


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: