国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

App下載
首頁(yè)javascripttext_inputjQuery Form - 如何從表單輸入顯示值

jQuery Form - 如何從表單輸入顯示值

我們想知道如何從表單輸入顯示值。

<!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>