首先定义一个json数组对象如下:
var persons = [
{name: "tina", age: 14},
{name: "timo", age: 15},
{name: "lily", age: 16},
{name: "lucy", age: 16}
]
往数组中添加一个对象:
persons.push({name: "similar", age: 18});
判断某个HTML标签是否存在某个属性:
if (typeof(val) == "undefined") {
layer.tips("#li_" + id, "请设置值!");
return;
}