Currently, I am utilizing the Prototype insert function to append some HTML that includes <script>...</script>
. Inside this script, a new function is being defined. According to what I have read here, Prototype executes the script within <script>
tags and then removes it, while keeping all functions accessible. However, after this process, I am unable to run my new function.
$('some_id').insert({ bottom: '<script> ... </script>' });
How can I resolve this issue? Ideally, I would prefer if it does not remove the <script>
tags.
EDIT:
My current workaround involves the following method:
var add_here = document.getElementById('prepayment_group_items');
var src = document.createElement('div');
src.innerHTML = 'a lot of HTML with script tags';
add_here.appendChild(src);