How do i find the last
  • in every

      2019-09-17 08:50发布

      I have a menu with their own submenus too.

      enter image description here

      Problem: When the page is loaded, the website emits a letter S at the end of every submenu.
      How can i remove that letter S at the end of every submenu via JQuery or CSS?

      This is the current markup when I copy html node in firebug:

      <nav class="shopMenuHover">
          <div id="bx_incl_area_5_1"> 
              <ul> 
                  <li class=""><a href="#" class="firstLevel"><font><font>Main Menu 1</font></font></a>
                  <div class="shopSubmenuHover" style=""><h2><a href="#"><font><font>Sub Menu 1</font></font></a></h2>
                      <ul> 
                          <li>
                              <a href=""><font><font>Sub Menu &gt; Sub Menu</font></font></a>
                          </li>
      
                          <li><a href="">Sub Menu &gt; Sub Menu</a> s</li>
                      </ul>
                  </div>
              </li>
      
      
              <li class="firstLevel hasSubmenu instrumentarium-en-fresen">
              <a href="#" class="firstLevel"><font><font class="">Main Menu 2</font></font></a>
      
              <div class="shopSubmenuHover" style=""><h2><a href=""><font><font class="">Sub Menu 2</font></font></a></h2>
                  <ul>
                      <li><a href=""><font><font>Sub Menu &gt; Sub Menu</font></font></a></li>
                      <li><a href="">Sub Menu &gt; Sub Menu</a> s</li>
                  </ul>
      
              </div>
              </li>
      
                  <li style="display:none " class="firstLevel hasSubmenu emptySubmenu outlet">
                                              <a href="#" class="firstLevel">Outlet<</a>
      
                  </li>
              </ul>
          </div>
      </nav>
      

      This is the jquery that i used to find the last li of every ul

      <script type="text/javascript">
        $(document).ready(function() {
           $('.shopMenuHover ul li:last-child').css( "border", "1px solid" );
        });
      </script>
      

      Kindly Please help me...

      1条回答
      Ridiculous、
      2楼-- · 2019-09-17 09:39

      Use this one

      <script type="text/javascript">
      
        $(document).ready(function() {
           $('.shopMenuHover ul li:last-child').contents(':not(a)').remove();
        });
      
      </script>
      
      查看更多
      登录 后发表回答