In my page I have a classname attribute with a tag. The classname is appended with a space character. I dont know where that space character is coming from? Where is it coming from?
I have the following code
if (collection[i].getAttribute("class") === "modified") {
var item = collection[i];
$(item).text("1");
editRowId = null;
$("#txtId").val("");
$("#txtName").val("");
}
$("#centerTable").append("<tr id='tableRow'><td id='rowid' class='hiddenColumn'>" + "-1" + "</td><td id='centerid'>" + centerid + "</td><td id='centerAddress'>" + centeraddress + "</td><td id='details'>" + txtDetails.value + "</td><td><a href='#' onclick='EditRecord(this)'>Edit</a></td><td><a href='#' onclick='DeleteRecord(this)'>Delete</a></td><td class='modified'>3</td></tr>");
I have the value of attribute classname = “modified ”
The white space is a killer. I have checke my html code it doesnt have a space anywhere near the classname.
Use the
hasClassmethod instead, then it doesn’t matter if there are extra spaces: