Note that there are some explanatory texts on larger screens.

plurals
  1. POOpera 12 and jQuery parent selector
    primarykey
    data
    text
    <p>This snippet of code is running really strange in Opera 12. <strong>parent</strong> element is just <strong>ul</strong> and this is what Firefox and Chrome returns.<br> In Opera <strong>$(this).parent()</strong> is returning <strong>Window</strong> object.</p> <p>Any ideas? jQuery version is 1.7.2</p> <pre><code>JS $('.addTrait').live('click', function(e) { e.preventDefault(); trait = $('li.trait.template').clone().removeClass('template'); parent = $(this).parent(); $(parent).after(trait); trait.show(); }); HTML &lt;ul class="sortable traits"&gt; &lt;li class="trait"&gt; &lt;div class="well slim"&gt; &lt;input class="trait name" type="text" name="trait[%s][name]" value=""/&gt; &lt;input class="trait id" type="hidden" name="trait[%s][id]" value=""/&gt; &lt;input class="trait parent" type="hidden" name="trait[%s][parent]" /&gt; &lt;a href="" class="addTrait icon-plus"&gt;&lt;/a&gt; &lt;a href="" class="removeTrait icon-remove"&gt;&lt;/a&gt; &lt;/div&gt; &lt;ul&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;li class="trait template" style="display: none;"&gt; &lt;div class="well slim"&gt; &lt;input class="trait name" type="text" name="trait[%s][name]" value=""/&gt; &lt;input class="trait id" type="hidden" name="trait[%s][id]" value=""/&gt; &lt;input class="trait parent" type="hidden" name="trait[%s][parent]" /&gt; &lt;a href="" class="addTrait icon-plus"&gt;&lt;/a&gt; &lt;a href="" class="removeTrait icon-remove"&gt;&lt;/a&gt; &lt;/div&gt; &lt;ul&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre>
    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.
 

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