Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd Link Before Element ul
    primarykey
    data
    text
    <p>everyone,</p> <p>I am still a beginner.</p> <p>I want to ask, I would like to add a link before the ul tag, as the following code</p> <pre><code>&lt;div id="PageList1" class="widget PageList"&gt; &lt;div class="widget-content"&gt; &lt;ul&gt; &lt;li class="selected"&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;Gallery&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I was adding the code <code>&lt;a href="#" id="pull"&gt; Menu &lt;/ a&gt;</code> and become like this</p> <pre><code>&lt;div id="PageList1" class="widget PageList"&gt; &lt;div class="widget-content"&gt; &lt;a href="#" id="pull"&gt;Menu&lt;/a&gt; /*---I would like to add this.----*/ &lt;ul&gt; &lt;li class="selected"&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;Gallery&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I tried to use the <code>before ()</code> but it does not work, hopefully you can help me.</p> <pre><code>$("#PageList1 ul").before("&lt;a id="pull" href="#"&gt;Menu&lt;/a&gt;"); </code></pre> <p>or</p> <pre><code>$("#PageList1 .widget-content").prepend("&lt;a href='#' id='pull'&gt;Menu&lt;/a&gt;"); </code></pre> <p>The code does not work.</p> <p>thanks, regards</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.
 

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