javascript - Find and remove <script> element with empty src attribute -
the facebook plugin wordpress has issue adds script element dom empty src attribute.
<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
Post a Comment