[Solved] If text() equal do something [closed]


As a work around for this problem, you can use like this,

 var interval = setInterval(function() {
   if ($('.weatherCity').length) {
     $('.weatherCity').each(function() {
       if ($(this).text().trim() == 'London') {
         $(this).text('London Weather');
       }
     });
     clearInterval(interval);
   }
 }, 100);

Fiddle

Constantly checks for the element using setInterval and stop checking once it is found.

solved If text() equal do something [closed]