Note that there are some explanatory texts on larger screens.

plurals
  1. POlist parent/child
    primarykey
    data
    text
    <p>I am a jQuery novice. I enjoy using jQuery and am attempting to get better at it.</p> <p>I have the following list as a menu:</p> <p>Page home: no child</p> <pre><code>&lt;ul class="menu"&gt; &lt;li&gt;Team 1 Photos&lt;/li&gt; &lt;li&gt;Team 2 Photos&lt;/li&gt; &lt;li&gt;Group Activities&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Sub-page has child</p> <pre><code>&lt;ul class="menu"&gt; &lt;li&gt;Team 1 Photos&lt;/li&gt; &lt;li&gt;Team 2 Photos&lt;/li&gt; &lt;li&gt;Group Activities &lt;ul class="children"&gt; &lt;li&gt;Team 1 News&lt;/li&gt; &lt;li&gt;Team 2 News&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>My CSS is:</p> <pre><code>ul.children { width: auto; margin-left: 0; } ul.children li{ border-bottom:1px solid #999; margin-bottom: 10px; padding-bottom: 3px; } ul.children li:last-child{ border-bottom:1px solid #999 !important; } ul.menu { width: auto; margin-left: 0; } ul.menu li{ border-bottom:1px solid #999; margin-bottom: 10px; padding-bottom: 3px; } ul.menu li:last-child{ border-bottom:none; } </code></pre> <p>I am trying to achieve; the last <code>&lt;li&gt;</code> to have border-bottom if there is no child. the last <code>&lt;li&gt;</code> to have no border if there is a child</p> <p>I hope I am making sense</p> <p>I have tried way to either directly apply the border yes/no or add a class so I can apply the style:</p> <pre><code>jQuery('#menu ul li:has(ul)').parent('li').prev()).css('border','1px solid #000'); </code></pre> <hr> <pre><code>if (jQuery('.menu li:has(ul)') ) { ('ul.menu li:last-child').add Class('borderme'); </code></pre> <hr> <pre><code>jQuery('.menu li:has(ul)').append('borderyes'); </code></pre> <hr> <p>An now I am stuck so please steer me in the right direction so I can learn how to achieve this.</p> <p>Thank you</p> <p>LRL</p>
    singulars
    1. This table or related slice is empty.
    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