jquery 动态添加标签而且指定样式

在jsp页面中给jquery 动态添加标签而且指定样式:

$("#id").append("<span style='color:red........'></span>");

$("input[value=查看]").click(function(){
   $.ajax({
        url:"AdminServlet",
        type:"post",
        data:{"action":"queryAll"},
        dataType:"JSON",
        success:function(result){
        $.each(result,function(i,result){
           $("input[value=查看]").after($("<br/><span style='background-color: yellow'>用户名:"+this.name+",密码:"+this.pwd+",昵     称:"+this.nickname+"</span>"));
        });
        
        }
       });
  });

posted @ 2016-11-01 09:23  从你的世界路过潘  阅读(2622)  评论(0编辑  收藏  举报