You find document.getElementById("groupid").value hard to interpret, or are you referring to a different line?

Either way, it seems like content loaded in through AJAX somehow cannot be found using the jQuery selection syntax whereas document.getElementById does in fact work.