$.ajax({
type: "post",
url: "hostPaas.htm",
data: {
} ,
dataType: "json",
success: function(data) {
var html = "";
for (var i=0;i<data.hostPaas.length;i++) {
var paasname = data.hostPaas[i].paasName;
var os = data.hostPaas[i].os;
var describe=data.hostPaas[i].describe;
html +='<li>';
html +='<p class="con" id="paasp">';
html +='<input type="radio" class="check" onclick="radio3(this)"value="">' ;
html +='<label><em>'+paasname+'</em></label>';
html +='</p>';
html +='<p class="con" id="paasp2">';
html +='<span>'+os+'</span>';
html +='</p>';
html +='<p class="con">';
html +='<span>'+describe+'</span>';
html +='</p>';
html +='</li>';
}
$("#paasShow").html(html);
},
ringa_lee2017-04-11 13:23:17
可以使用 data-id
避免 id
重复的问题
html +='<p class="con" data-id="paasp">';
获取
$('p[data-id=passp]'); // 可以遍历,可以绑定事件,看你的需求