1

How to remove all pseudo before elements except first and last in an unsorted list using jQuery or JavaScript?

<ul class="nav">
    <li id="menu-item-241">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
    <li id="menu-item-242">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
    <li id="menu-item-243">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
    <li id="menu-item-244">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
    <li id="menu-item-245">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
    <li id="menu-item-246">
        ::before
        <a href="">
            <span>Some text</span>
        </a>
    </li>
</ul>

Obviously I'm not going to hide each before element with css for each menu item id so what's the most efficient way? Thanks for your time.

Marco V
  • 2,553
  • 8
  • 36
  • 58

0 Answers0