Question: How can we get values of form elements inside fieldset?

```
<fieldset id='myFieldset'>
  <label for='Resp'>Responsibilities</label><input id='input' type='text' size='55'>
  <button type='button' class='btn-sm' style='width:50px;margin:2px' id='addItem'>Add</button>
  <button type='button' class='btn-sm' style='width:50px;margin:2px' id='clear'>Clear</button>
  <button type='button' class='btn-sm' style='width:50px;margin:2px' id='edit'>Edit</button>
  <ul id='output' style='display:none'></ul>
  <br class='clear' /> 
  <textarea disabled name='Resp' id='Resp' cols='75' rows='5' required></textarea>
</fieldset>

```

I have some more fields similar to this in a page. So I need to get values from input form and also from specific fieldset. How can I do it in jQuery?

Answer: 
If you are using id attributes:

```
<input type="text" id="txtData" name="txtData" />

```

**JQuery:**
 $("#myFieldset #txtData").val();

If you are using class attributes.

```
<input type="text" class="txtEmail" />

```

**Jquery**
$("#myFieldset .txtEmail").val();

You are able to get all ids value from fieldset as below:

**Html**

```
<fieldset id='myFieldset'>
      <input type="text" id="txtData" name="txtData" />
      <input type="text" class="txtEmail" />
      <input type="button" class="btntest" />
  </fieldset>

```

**jQuery**

```
$(".btntest").click(function () {
            $("#myFieldset input[type != button]").each(function(key,value){
                alert($(this).val());
            });
        });

```

So this thing will give you all inputs not then type = button value.
Try this:

```
var inputVal = $('#myFieldset #input').val();
var textAreaVal = $('#myFieldset #Resp').val();

```