<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> <script src="../jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ $("input[type='button']").click(function(){ var i = 0; $("input[type='text']").each(function(){ i += parseInt($(this).val()); }); $('label').text(i); }); $('input:lt(2)') .add('label') .css('border', 'none') .css('borderBottom', 'solid 1px navy') .css({'width':'30px'}); }); </script> </head> <body> <input type="text" value="1" />+ <input type="text" value="2" /> <input type="button" value="=" /> <label> </label> </body> </html>