Chan
Chan

Reputation: 61

Unexpected Identifier in Chrome's Javascript console

<div id="my-page" style="width:100%; height:640px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container">
  <script>
    $("#my-page").html('<iframe style="
            top: 0 px; left: 0 px; width: 101 % ; height: 100 % ; position: absolute;
            " mozallowfullscreen="
            true " webkitallowfullscreen="
            true " allowfullscreen="
            true " src="
            http: //www.flipbeets.com/get-embedded-code/zimbabwecricket/p~1~2~1?slug-hash=HrFBx&default-tab=result&host=http%3A%2F%2Fcodepen.io" class="iframely-widget iframely-iframe" frameborder="0"></iframe>');
  </script>
</div>

Unexpected Identifier in Chrome's Javascript console.

(Note, code tidied up with this formatter.)

Upvotes: 1

Views: 248

Answers (2)

NDY
NDY

Reputation: 3557

You need to remove the double quotes ". You cant use it in the .html("") and in the style definitions too. You should work with ' and " together.

<div id="my-page" style="width:100%; height:640px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container">
  <script>
    $("#my-page").html('<iframe style="
            top: 0 px; left: 0 px; width: 101 % ; height: 100 % ; position: absolute;
            " mozallowfullscreen="
            true " webkitallowfullscreen="
            true " allowfullscreen="
            true " src="
            http: //www.flipbeets.com/get-embedded-code/zimbabwecricket/p~1~2~1?slug-hash=HrFBx&default-tab=result&host=http%3A%2F%2Fcodepen.io" class="iframely-widget iframely-iframe" frameborder="0"></iframe>');
  </script>
</div>

Upvotes: 2

kyriosli
kyriosli

Reputation: 333

just try to modify string quotes to ' like:

$("#my-page").html('<iframe style="t...></iframe>')

Upvotes: 2

Related Questions