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);

posted @ 2016-02-19 15:23  咸鱼公子  Views(128)  Comments(0Edit  收藏  举报