I have a BootStrap selection window, and I'm trying to find the optgroup of the selected option.
Here is a bootstrap selection window with these parameters:
<li rel="1"> <div class="div-contain"> <div class="divider"></div> </div> <dt> <span class="text">Option Set 1</span> </dt> <a tabindex="0" class="opt " style=""> <span class="text">Option 1</span> <i class="fa fa-ok icon-ok check-mark"></i> </a> </li> <li rel="2" class="selected"> <a tabindex="0" class="opt " style=""> <span class="text">Option 2</span> <i class="fa fa-ok icon-ok check-mark"></i> </a> </li>
EDIT: My recent attempt, based on @Soren Beck Jensen, replies:
$('i.check-mark').closest('li.selected').find('dt>span').text();
This gives me “Option Set 1” for everyone and any options that I select in the first drop down menu.
jquery html
Rishi jasapara
source share