0
我在drupal中有一個包含如此多菜單項的頁腳菜單。jquery preventDefault with drupal菜單
<ul class="menu">
<li class="expanded first business">
<a title="" href="/content/business-tab">Business</a>
<ul class="menu">
<li class="leaf first about_business_mobile">
<a title="" href="/content/about-business-mobile">About Business Mobile</a>
</li>
<li class="leaf business_mobile_solutions">
<a title="" href="/content/business-pay-monthly">Business Mobile Solutions</a>
</li>
<li class="leaf value_packs">
<a title="" href="/content/business-value-packs">Value Packs</a>
</li>
<li class="leaf mobile_broadband">
<a title="" href="/content/mobile-broadband">Mobile Broadband</a>
</li>
<li class="leaf handsets">
<a title="" href="/content/handsets">Handsets</a>
</li>
<li class="leaf overseas_roaming">
<a title="" href="/content/overseas-roaming">Overseas Roaming</a>
</li>
<li class="leaf last overseas_calling_rates">
<a title="" href="/content/overseas-calling-rates">Overseas Calling Rates</a>
</li>
</ul>
</li>
<li class="expanded personal">
<a title="" href="/content/personal">Personal</a>
<ul class="menu">
<li class="leaf first about_personal_mobile">
<a title="" href="/content/personal-prepay">About Personal Mobile</a>
</li>
<li class="leaf personal_mobile_solutions">
<a title="" href="/content/personal-prepay">Personal Mobile Solutions</a>
</li>
<li class="leaf value_packs">
<a title="" href="/content/additional-packs-0">Value Packs</a>
</li>
<li class="leaf mobile_broadband">
<a title="" href="/content/mobile-broadband">Mobile Broadband</a>
</li>
<li class="leaf handsets">
<a title="" href="/content/handsets">Handsets</a>
</li>
<li class="leaf overseas_roaming">
<a title="" href="/content/overseas-roaming">Overseas Roaming</a>
</li>
<li class="leaf last overseas_calling_rates">
<a title="" href="/content/overseas-calling-rates">Overseas Calling Rates</a>
</li>
</ul>
</li>
</ul>
這只是菜單的第一個元素。我想要的是,當我點擊商業菜單時,什麼都不會發生。所以爲此,我使用了Jquery preventDefault函數。
$('#footer li.expanded a:first-child').click(function(e) {
e.preventDefault;
});
但是,當我執行該腳本,它只是停止擴展菜單下各個環節的工作。
我不知道爲什麼它不工作。仍然沒有成功。 –
適用於我:http://jsfiddle.net/zShEj/ – wanovak
對不起,我現在的錯誤工作正常。非常感謝wanovak。 –