javascript - Enable script tags with different type? Changing type attribute is not enought -


is possbile run code previosly of ignored content type. example:

<script type="jquery">alert('working!')</script> 

of course tag ignored , not enable it. tried this:

$(document).ready(function() {     $('script[type=jquery]').attr('type','text/javascript'); }); 

but nothing happens :/

thanks help!

yes can it, option recreate new script tag , remove existing:

$(document).ready(function() {      $('script[type=jquery]').each(function(){          $(this).after(this.outerhtml.replace('jquery','text/javascript')).remove();      })  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>    <script type="jquery">alert('working!')</script>


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -