regex - JQuery * (all elements) selector excluding span tags that have some class. How could I make this work? -


this first code

var operations = 0; $('body').bind('domcharacterdatamodified, domnodeinserted, domsubtreemodified', 'test', function() {     if (operations < 1) {         tba_highlight_numbers();     }     operations++; }); 

and, here latest code of "tba_highlight_numbers" function.

function tba_highlight_numbers() {  //highlighting number on webpage. $("body *:not(span.tba_phone)").replacetext(/\d*[/\(-]*[0-9][0-9][0-9][/ \)\(-]*[0-9][0-9][0-9][/ \)\(-]*[0-9][0-9][0-9][0-9][/ \) ]*/g, function(ss) {     return '<span class="tba_phone" title="make call (' + $.trim(ss) + ') via act browser applet" style="color:green" rel="' + $.trim(ss) + '">' + ss + '</span>'; });  } 

this js code performs operation of highlighting phone numbers on web page. can see in first part, function called many times data modified on web page dynamically via ajax request , other methods.

so, aim not perform operations on highlighted one.

can me in achieving this.

change function to

function tba_highlight_numbers() {      //highlighting number on webpage.     $("body *:not(span.tba_phone)").filter(function(){ return $(this).hasclass(".already-hightlighted");}).replacetext(/\d*[/\(-]*[0-9][0-9][0-9][/ \)\(-]*[0-9][0-9][0-9][/ \)\(-]*[0-9][0-9][0-9][0-9][/ \) ]*/g, function(ss) {         return '<span class="tba_phone" title="make call (' + $.trim(ss) + ') via act browser applet" style="color:green" rel="' + $.trim(ss) + '">' + ss + '</span>' + ss;     });     $("body *:not(span.tba_phone)").addclass('already-highlighted');   } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -