How to copy and paste code snippets

Problems can arise from pasting incomplete HTML code snippets. Whether it’s a missing closing tag or a partial structure, these issues can cause significant functionality and display errors on your page.


👎 Incorrect approach:  Although simple to avoid, this is a common issue. 

A user highlights a snippet of code being provided to them by a 3rd party provider (eg. Google Analytics, HotelMaps.com, Marketo…) but doesn’t highlight the entire piece of code.  This will always be caused by a user not ensuring the entire piece of code is copied from the source.


Incorrect Example: <iframe width="560" height="315" src="https://www.youtube.com/embed/C8ejLNTale0?si=Hy9823DwwHkO7QqV" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></ifra


In this example, the end of the code does NOT have a closing bracket, or even a complete closing tag.


👍 Correct approach:  Simply ensure that the entire snippet of code being provided by the 3rd party provider is complete, and should always begin with an opening bracket “<” and end with a closing bracket “>”.

Think about when you might copy and paste a password. If even one character is missing or incorrect, the password will not work. It’s exactly the same with code. 


Correct example: <iframe width="560" height="315" src="https://www.youtube.com/embed/C8ejLNTale0?si=Hy9823DwwHkO7QqV" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>


This is the same example code snippet as shown in the 'Incorrect approach' but you can see it is now complete. The end of the snippet includes a closing tag and bracket... '</iframe>'.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.