javascript - jquery remove based on before content -


is possible write jquery function remove specific :before content.

here example statement give show me code:

remove elements in document have :before pseudo element content set "delete me"

mhh, can try this:

var sheets = document.stylesheets; var len = sheets.length; var ba = /:before|:after/;  // loop throught stylesheets (var = 0; < len; i++) {      // work out method css rules     var sheet = sheets[i],         rules = sheet.cssrules || sheet.rules;      // loop through rules     (var r = 0, rule; rule = rules[r++];) {          // if rule uses 1 of test selectors         if (rule.selectortext.match(ba)) {             if (rule.style.content.indexof('delete me') !== -1) {                 var elems = document.queryselectorall(rule.selectortext.split(':')[0]);                             (var e = 0, elem; elem = elems[e++];) {                     // remove node                     document.body.removechild(elem);                 }             }         }     } } 

http://fiddle.jshell.net/6m5kb/1/


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -