【JavaScript】获取所有相同class名称的控件
var editStr = "<span id='diySpan_space_" +treeNode.id+ "' > <img src='../../../new_website/icon/icon_role.png' id='diyIcon_" +treeNode.id+ "' style='cursor: pointer; width: 18px' /> </span> <span style='color: red' id='span_PropertyName_"+treeNode.id+"'>"+PropertyName+"</span> <span style='color: red; display: none' id='span_PropertyID_"+treeNode.id+"' class='spanProperty'>"+PropertyInfo+"</span>" ; var jsonarray = []; var arr = ""; $(".spanProperty").each(function(){ if($(this).text()!=''){ arr = { "id": $(this).text().split('-')[1], "name": $(this).text().split('-')[2], "pId": $(this).text().split('-')[0], "IsProperty": 2 } jsonarray.push(arr); } })