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()

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

`$(".form-group").find("input[name='searchOption']:checked")` will get you the selected item.

If you need to find out which one was clicked you could also use this to get the `id`: 

```
$(".form-group").find("input[name='searchOption']:checked").attr("id")

```