Reputation: 1743
function showSchedule() {
if (request.readyState == 4) {
if (request.status == 200) {
document.getElementById("content").innerHTML = request.responseText;
/* put alert to enroll submit button */
document.getElementById("enroll").onclick = doIt;
}
}
}
function doIt() {
alert("tu$a bastIn");
}
enroll is a button in coming with in request.responseText. I debug and see document.getElementById("enroll") is there (not null) but i can not assign doIt function. Any suggestions ?
Upvotes: 0
Views: 1186
Reputation: 1303
when document.getElementById("enroll")
is not null, then you have several elements with this id (may also be detached).
you overwrite some content where this id is present or have used this somewhere else.
Upvotes: 1