jquery当中each type text的用法

例 1.11(each&add&[type&text.html)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script language="javascript" src="jquery.min.js"></script>
</head>
<body>
    <input value="11" /> +
    <input value="22" />
    <input type="button" value="=" />
    <label>0</label>
    <script type="text/javascript">
        $("input[type='button']").click(function(){undefined
            var sum = 0;
            $("input[type='text']").each(function(){//每个都执行一遍function
                sum += parseInt($(this).val());
            });
            $('label').text(sum);
        });
    </script>
</body>
</html>

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44594371/article/details/103054317

posted @ 2021-12-31 17:20  malala  阅读(37)  评论(0编辑  收藏  举报