Question: I have the following HTML code:

```
<div class="form-group">
    <label class="radio radio-inline checked">
      <input type="radio" name="searchOption" id="searchByCity" value="searchByCity"> City
    </label>
    <label class="radio radio-inline">
      <input type="radio" name="searchOption" id="searchByZipCode" value="searchByZipCode"> ZIP Code
    </label>
    <label class="radio radio-inline">
      <input type="radio" name="searchOption" id="searchByGeolocation" value="searchByGeolocation"> Geolocation
    </label>
</div>

```

How can I know which element has the `checked` class ?

I try with this, whiteout any success:

```
alert($('label.radio-inline > input[name="searchOption"]:checked').val());

```

Note: The `checked` option is had to the `label` not the the `input`... 

Thanks.

Answer: 
You can access the value of radio button inside label having class `checked` as follows:

```
$(".form-group label.checked").find("input[name='searchOption']").val()

```
You can alternative use [.hasClass()](http://api.jquery.com/hasclass/) :

```js
$("#getValues").on("click", function(){
    var checkedValue = $("label").map(function(){
        return $(this).hasClass("checked") ? $(this).children("input:radio:checked").val() : "";      
    }).get().join("");
    alert(checkedValue);
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
    <label class="radio radio-inline">
        <input type="radio" name="searchOption" id="searchByCity" value="searchByCity" /> City
    </label>
    <label class="radio radio-inline checked">
        <input type="radio" name="searchOption" id="searchByZipCode" value="searchByZipCode" checked="true" /> ZIP Code
    </label>
    <label class="radio radio-inline">
        <input type="radio" name="searchOption" id="searchByGeolocation" value="searchByGeolocation" /> Geolocation
    </label>
</div>

<input type="button" id="getValues" value="get check value" />
```