...as they're based on the group and question id which change with reordering
Using LS ≥1.92, {SGQ} keyword is doing the job, so you can adapt js codes this way:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var SGQ = '{SGQ}';
$('#answer'+SGQ).attr(…..
});
</script>