JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

Step 1: <div id='ajaxPagedef' style='color:blue'>click here</div>
        => nothing happens in IE7 and IE9<br>
        <br>
        Step 2:<br>
        <div onclick="jQuery('#ajaxPagedef').html(jQuery('#ajaxPagedef').html())" style='color:blue'>click here to fix step 1</div>
        => now clicking Step 1 works and will result in an alert.<br>
        <br>
        <br>
        so after the first html(..) call, the onclick event isn't registered, only after the second html(..) call it is.

JavaScript

jQuery('#ajaxPagedef').html("<div><div onclick=\"testFunc()\">click</div><script>function testFunc(event) {alert('testFunc');}<\/script></div>");