Reputation: 241
let's assume that the content is empty as given below.
<head>
</head>
If I want to change it dynamically to
<head>
<script src="jquery-1.8.0.min.js"></script>
</head>
is there anyway that AppInventor can do that?
Upvotes: 3
Views: 19045
Reputation: 808
How about:
var HeadScript = document.createElement("SCRIPT")
HeadScript.src = "jquery-1.8.0.min.js"
document.head.appendChild(HeadScript)
Upvotes: 0
Reputation: 6887
You can select it and add to it as normal:
$('head').append('</script>');
JavaScript:
document.getElementsByTagName('head')[0].appendChild( ... );
Make DOM element like so:
script=document.createElement('</script>');
script.src='src';
document.getElementsByTagName('head')[0].appendChild(script);
Upvotes: 3
Reputation: 4465
Some simple javascript to change the innerHtml of document.head
will work
document.head.innerHTML = "<script src=\"jquery-1.8.0.min.js\"></script>";
Upvotes: 1