I'm having trouble replacing text with a div that includes a checkbox. When I have the following code, the text successfully gets replaced:
<p>Hello</p
<p class="replaced">Hello</p>
<p class="replaced">World</p>
<script>
$( ".replaced" ).replaceWith("<div>REPLACING TEXT.</div>");
</script>
When the replacing text includes a checkbox, however, the script stops working. To be specific, the following does not work:
<p>Hello</p
<p class="replaced">Hello</p>
<p class="replaced">World</p>
<script>
$( ".replaced" ).replaceWith("<div><input type="checkbox" id="fractionsandratioscheck1" class="checkappear"/>REPLACING TEXT.</div>");
</script>
If someone could explain how to fix this, I would appreciate it. Thanks!