这里是jsFiddle:http://jsfiddle.net/6eqMn/524/
JS 部分:
$("#divProcedureCodes").append("<TABLE><TBODY><TR ID='divtr2' STATUS='Map'><TD STYLE='WIDT`enter code here`H: 20px'></TD></TR></TBODY></TABLE>");
function allChargesMapped() {
var retval = true;
$.each($("#divProcedureCodes tr"), function (index, value) {
if (this.status == "Map") {
retval = false;
return false;
}
});
return retval;
}
var ret = allChargesMapped();
alert(ret);
alert(document.getElementById("divtr2").getAttribute("status"));
HTML 部分:
<DIV ID="divProcedureCodes"> </DIV>
答案 0 :(得分:0)
使用getAttribute()
功能。你不能像通常的属性那样以通常的方式得到它。
this.getAttribute('status')
var aq = $("#divProcedureCodes tr");
$("#divProcedureCodes").append("<TABLE><TBODY><TR ID='divtr2' STATUS='Map'><TD STYLE='WIDTH: 20px'></TD></TR></TBODY></TABLE>");
function allChargesMapped() {
var retval = true;
$.each($("#divProcedureCodes tr"), function(index, value) {
alert(this.getAttribute('status'));
if (this.getAttribute('status') == "Map") {
retval = false;
return false;
}
});
return retval;
}
var ret = allChargesMapped();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<DIV ID="divProcedureCodes"></DIV>