我想獲得活動類的元素的id的id。我查看了this thread,但無法獲得我想要的o/p。獲得課堂活動類的ID?
<ul class="nav nav-pills nav-stacked navigation" id="configuration_sidebar_content">
<li>
<a>Location</a>
<ul class="nav nav-pills nav-stacked " id="location" style="padding-left:30px;">
<li class="active" id="region"><a>Region</a></li>
<li id="country"><a>Country</a></li>
</ul>
</li>
<li>
<a>Device</a>
<ul class="nav nav-pills nav-stacked" style="padding-left:30px;">
<li id="gateway_unit"><a>Gateway Unit</a></li>
<li id="meter_unit"><a>Meter Unit</a></li>
</ul>
</li>
</ul>
我試圖這一點。
selected_item_id = $("#configuration_sidebar_content li.a.active").attr('id')