I would like to add some Javascript to a HTML head like this:
var scriptInjection = "<script type='text/javascript'/>function toggleVisibility() {$('#ivuFrm_page0ivu1').contents().find('.tableContentRow').toggle()}</script/>";
$('#ivuFrm_page0ivu1').contents().find("head").each(function(){
console.log($(this).prop("tagName"))
$(this).append(scriptInjection);
});
This is only appending a string though and not the script element. How can I resolve this?
<means nothing to JS. if it was"<script...>", then it'd be seen as html. ditto for>