title: get the id of the class which has class active?
body: <p>I want to get the id of the id of the element which has class active. I've viewed <a href="https://stackoverflow.com/questions/10695828/how-do-i-get-an-id-of-an-element-which-has-a-class">this thread</a> , but isnt able to get the o/p I want. </p>
  
  <pre><code>&lt;ul class="nav nav-pills nav-stacked navigation" id="configuration_sidebar_content"&gt;
       &lt;li&gt;
          &lt;a&gt;Location&lt;/a&gt;
          &lt;ul class="nav nav-pills nav-stacked " id="location" style="padding-left:30px;"&gt;
              &lt;li class="active" id="region"&gt;&lt;a&gt;Region&lt;/a&gt;&lt;/li&gt;
              &lt;li id="country"&gt;&lt;a&gt;Country&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
       &lt;/li&gt;
       &lt;li&gt;
           &lt;a&gt;Device&lt;/a&gt;
           &lt;ul class="nav nav-pills nav-stacked" style="padding-left:30px;"&gt;
                &lt;li id="gateway_unit"&gt;&lt;a&gt;Gateway Unit&lt;/a&gt;&lt;/li&gt;
                &lt;li id="meter_unit"&gt;&lt;a&gt;Meter Unit&lt;/a&gt;&lt;/li&gt;
           &lt;/ul&gt;
       &lt;/li&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>I <strong>tried</strong> this.</p>
  
  <pre><code>selected_item_id = $("#configuration_sidebar_content li.a.active").attr('id')
  </code></pre>