[SOLVED] Adding HTML an asset

Yes, if you are adding the functionality from a library you can’t append the library inside the HTML.

You have to include it in your Playcanvas project either by uploading the bootstrap.js file as an asset or loading it manually in code:

You need to do that before attaching your HTML, so bootstrap is already available.

Also make sure to remove the <html>,<head>,<body> elements from your HTML file. Since you aren’t attaching an HTML document, only appending elements to the existing main HTML document (in short you can’t have many <html> elements in the same HTML document).

Just this:

<div class="container">
  <div class="dropdown">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
      Dropdown button
    </button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">C</a>
      <a class="dropdown-item" href="#">C#</a>
      <a class="dropdown-item" href="#">D</a>
      <a class="dropdown-item" href="#">D#</a>
      <a class="dropdown-item" href="#">E</a>
      <a class="dropdown-item" href="#">F</a>
      <a class="dropdown-item" href="#">F#</a>
      <a class="dropdown-item" href="#">G</a>
      <a class="dropdown-item" href="#">G#</a>
      <a class="dropdown-item" href="#">A</a>
      <a class="dropdown-item" href="#">A#</a>
      <a class="dropdown-item" href="#">B</a>
      <a class="dropdown-item disabled" href="#">Disabled</a>
    </div>
  </div>
</div>
2 Likes