jquery 操作大全

1添加属性

$("#mydiv").attr("pro1","this is val");

 $('.img1').attr('src', '/img/1.jpg');

2设置样试

$("#mydiv").css("width","100px");

 

3操作json取值

var jsonstr="Result:{"pagecount":"5","pagesize":"5","pageindex":"1","pic":["/image/g1.jpg","/image/g2.jpg","/image/g3.jpg","/image/g4.jpg","/image/g5.jpg"]}";

 var contact = JSON.parse(jsonstr);

alert(contact.pagecount);

你可能感兴趣的:(jquery 操作大全)