I tried to entirely script this checkbox check / uncheck snippet of code in jQuery, but it did not have any success. Here is the jQuery/JavaScript code:
$.ajax({
type: "GET",
url: "check.xml",
cache: false,
dataType: "xml",
success: function(xml) {
$(xml).find("check").each(function(){
$(xml).find("todo").each(function(){
var state = $(this).attr("state");
if (state == "true") {
document.getElementById($(this).attr("id")).checked = true;
} else {
document.getElementById($(this).attr("id")).checked = false;
}
});
});
}
});
It's probably very possible to do the document.getElementbyId(blablabla)....
using only jQuery. I tried this:
($(this).attr("id")).prop("checked", true)
But that didn't really work as expected. Any suggestions?