[英]Foundation dropdown selected value
我有一個像下面這樣的基礎下拉列表
<a href="#" data-dropdown="drop1" id="dateTitle">Date Range </a>
<ul id="drop1" class="f-dropdown small date-menu" drop-down-content>
<li id="custom">Custom</li>
<div id="customContainer"></div>
<li id="today"> Today</li>
<li id="yesterday">Yesterday</li>
<li id="sundaytoToday">This Week(Sun-Today)</li>
<li id="montoToday">This Week(Mon-Today)</li>
<li id="lastSevenDays">Last 7 Days</li>
<li id="lastSuntoSat">Last Week(Sun - Sat)</li>
<li id="lastMontoSun">Last Week(Mon - Sun)</li>
<li id="lastBusinessWeek">Last Business Week(Mon - Fri)</li>
<li id="lastFourteenDays">Last 14 days</li>
<li id="thisMonth">This Month</li>
<li id="lastThirtyDays">Last 30 days</li>
<li id="lastMonth">Last Month</li>
<li id="allTime">All Time</li>
<hr>
<li id="compare">Compare
<div class="onoffswitch">
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<div class="onoffswitch-inner"></div>
<div class="onoffswitch-switch"></div>
</label>
</div>
</li>
<div id="extraContainer"></div>
<div align="center"><button class="date-picker-submit">Apply</button></div>
</ul>
當用戶單擊列表項,然后單擊底部的“應用”按鈕時,我要獲取列表中的選定項
我沒有怎么做
$('.date-picker-submit').click(function(){
//get the selected value
});
這樣做:
$('#drop1 li').click(function(){
$('#drop1 li').removeClass("selected");
$(this).addClass("selected");
});
現在單擊按鈕:
$('.date-picker-submit').click(function(){
$('#drop1 li.selected').text();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.