如何在jQuery中的类Menu下选择所有元素?

时间:2016-06-21 01:45:54

标签: jquery

我希望在类a下选择所有元素Menu,我使用代码

$("Menu > a").removeClass();  

但没有选中,我该怎么做?谢谢!

  <div id="tabs" class="ShortWidth">
           <ul>
               <li><a href="#tabs-1">Internal Storage</a></li>
               <li><a href="#tabs-2">External Storage</a></li>              
           </ul>

           <div id="tabs-1" style="padding-bottom:30px;">
              <div class="Menu" >
                <a id="index0" href="index.htm?disk=0" class="MenuItem">My Image</a>
                <a id="music0" href="music.htm?disk=0" class="MenuItem">My Music</a>
                <a id="video0" href="video.htm" class="MenuItem">My Video</a>
                <a id="allfile0" href="allfile.htm" class="MenuItem">All File</a>
                <a id="search0" href="search.htm" class="MenuItemSelected">Search</a>
              </div>
           </div>

           <div id="tabs-2" style="padding-bottom:30px;">
              <div class="Menu" >
                <a id="index1" href="index.htm?disk=0" class="MenuItem">My Image</a>
                <a id="music1" href="music.htm?disk=0" class="MenuItem">My Music</a>
                <a id="video1" href="video.htm" class="MenuItem">My Video</a>
                <a id="allfile1" href="allfile.htm" class="MenuItem">All File</a>
                <a id="search1" href="search.htm" class="MenuItemSelected">Search</a>  
              </div>
           </div>         

       </div>

1 个答案:

答案 0 :(得分:1)

$('.Menu a').event();
你去吧!
在您的示例中:

$('.Menu a').removeClass("MenuItem");