Javascript date picker error in iframe

Viewed 1601

I have a page https://dev.leadformly.com/datepicker having an iframe In that particular '', I am writing the HTML code dynamically by ajax call by the following code.

<script>
  $(document).ready(function(){
    $.post(URL,
        function (data) { //here it retruns the HTML code
          $("body").html('<iframe style="width:100%;height:384px;"></iframe>');
          $("body iframe")[0].contentDocument.write(data.democode);
        },
        'json'
      );
    });
</script>

Now when I click on the date picker it will throw an error in the console like:

Uncaught TypeError: Cannot read property 'top' of undefined

Can you help me to resolve this issue? Or just explain the cause so it will help me to resolve it

3 Answers
Related