<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){
$('input#btn').click(function(){
var $inputs = $('form#frm1 :input[type="text"]'),
result = "";
$inputs.each(function(){
result += $(this).val()+"<br>";
});
$('div#result').html(result);
});
});
</script>
</head>
<body>
<form id="frm1">
First name: <input type="text" name="fname" value="" /><br />
Last name: <input type="text" name="lname" value="" /><br />
<input type="button" id="btn" value="Submit" />
</form>
<div id="result">text will appear here</div>
</body>
</html>