• 想认识each()看这里


    $('.creded').each(function(n){
                    $(this).mouseover(function() {
                        $(this).children('.crededed').css('display','block');
                    });
                    
                    $(this).mouseleave(function() {
                                $(this).children('.crededed').css('display','none');
                    });
                });

    以上是列表每个鼠标移动上去就显示各自的东西 执行的东西,要让每一个符合要求的都适用

    link: function (scope, element, attrs)
                {
                    angular.element(element).find("input[theme]").each(function ()
                    {
                        var datas = "";
                        if ($(this).is(':checked'))
                        {
                            var className = $(this).attr("className");
                            datas = "css/skincss/" + className + ".css";
                            scope.themesheet.attr('href', datas);
                        }
                       
                        $(this).on('click', function () {
                            //var index = $(this).attr("theme");
                            var className = $(this).attr("className");
                            datas = "css/skincss/" + className + ".css";
                            scope.themesheet.attr('href', datas);
                        })
                      
                    })
    
                }

    每一个都要(搞)(遍历)一遍

    <script type="text/javascript">
    $(document).ready(function(){
      $("button").click(function(){
        $("li").each(function(){
          alert($(this).text())
        });
      });
    });
    </script>

    w3cschool  each() 方法规定为每个匹配元素规定运行的函数。

  • 相关阅读:
    Mac OS使用brew安装memcached
    Mac OS使用brew安装memcached
    Mac OS使用brew安装memcached
    JAVA学习之路 (五) 类
    JAVA学习之路 (五) 类
    JAVA学习之路 (五) 类
    JAVA学习之路 (五) 类
    常用的CSS小技巧
    常用的CSS小技巧
    常用的CSS小技巧
  • 原文地址:https://www.cnblogs.com/dlgood/p/6527119.html
Copyright © 2020-2023  润新知