Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may try this:</p> <pre><code>$('#container').append(renderer.domElement); </code></pre> <p><code>$('#container')</code> returns a jQuery Object, where <code>appendChild()</code> is a JavaScript method which works with a JavaScript DOM element, but not with a jQuery object.</p> <p>Therefore, to append use the jQuery method <strong><em><a href="http://api.jquery.com/append" rel="nofollow"><code>.append()</code></a></em></strong>.</p> <hr> <p>As your <code>#container</code> is a <code>canvas</code> element, it does not support the <code>appendChild()</code> method. Instead you can change it to a <code>div</code> like:</p> <pre><code>&lt;div id="container" name="container" style:"width:300;height:300"&gt;&lt;/div&gt; </code></pre> <p>and then try with:</p> <pre><code>document.getElementById('container').appendChild(renderer.domElement); </code></pre> <p><em><strong>OR</em></strong></p> <pre><code>$('#container').append(renderer.domElement); </code></pre> <p>Here, you do not need to add a <code>&lt;canvas&gt;</code> either, because <code>renderer.domElement</code> is a <code>canvas</code> element. For example, in <strong><em><a href="http://mrdoob.github.com/three.js/examples/webgl_materials_bumpmap.html" rel="nofollow">this link</a></em></strong>, the view source shows there is no <code>&lt;canvas&gt;</code> in the <code>HTML</code>. Instead, it creates a <code>div</code> by JavaScript, appends that to the <code>DOM</code> and at last appends the <code>renderer.domElement</code> (which is <code>&lt;canvas&gt;</code>) to that <code>div</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload