Remove duplicated scripts in an HTML head - Javascript String Operation

Javascript examples for String Operation:String Remove

Description

Remove duplicated scripts in an HTML head

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-2.0.3.js"></script> 
  <script src="http://facebook.com"></script> 
  <meta name="viewport" content="width=device-width"> 
 </head> //  ww w.j  a va 2  s. co  m
 <body> 
  <script>
$(document).ready(function(){
  console.log($('script[src="http://java2s.com"]').length);
});

      </script>  
 </body>
</html>

Related Tutorials