美文网首页
js-jQuery 属性操作

js-jQuery 属性操作

作者: AssertDo | 来源:发表于2019-08-20 09:45 被阅读0次
                    //jquery 设置单个属性
                    $("img").attr("title","图片");
                    
                    //jquery 设置多个属性
                    $("img").attr({
                        alt : "名字",
                        title : "标题",
                        custom : "自定义属性"
                    });
                    
                    //jquery 获取属性
                    $("img").attr("title");
    
    

    相关文章

      网友评论

          本文标题:js-jQuery 属性操作

          本文链接:https://www.haomeiwen.com/subject/rpdusctx.html