javascript - Find and remove <script> element with empty src attribute -


the facebook plugin wordpress has issue adds script element dom empty src attribute.

http://wordpress.org/support/topic/w3c-validation-error-caused-my-empty-src-tag-generated-by-plugin?replies=3

<script type='text/javascript' src=''></script> 

the link above suggests editing core wp files.. question is, there way find , remove using jquery?

something below, didn't work in locating empty src / script element.

$('footer script').each(function(){          if($(this).attr('src') == 'undefined' && $(this).length < 1){             $(this).remove();           }       }) 

edit : since asking question i've come realise need remove script element using php, in order page validate.

you've got it:

$('footer script').each(function(){      if(!$(this).attr("src")){         $(this).remove();       }   }); 

this remove every script tag empty src. won't prevent validation failing, however.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -