JavaScript inside Collapsible

JavaScript inside Collapsible

Hello,

I am using JQM 1.2.0 and I have a simple collapsible with JavaScript inside:

<div data-role="collapsible" data-collapsed="false">
    <h3>Section Header</h3>
    <script>alert("Test");</script>
</div>

The problem is that when the page loads, the JavaScript inside the collapsible is executed twice.

The example is simple to illustrate the problem and in production, there is no way to move the script outside of the collapsible.

How can I instruct JQM to NOT execute the script two times?