jquery中使用表单元素选择器


[示例代码]

<html>
  <head>
    <script src="jquery-1.2.js"></script>
    <script>
      $(document).ready(
        function () {
          $("#form :text").each(
            function (index, element) {
              $(element).css("background-color", "yellow");
            }
          );
        }
      );
    </script>
  </head>
  <body>
    <form id="form">
      <input type="input" />
      <input type="input" />
      <input type="input" />
      <input type="submit" />
    </form>
  </body>
</html>

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3