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
Post a Comment