I have some html like this:
Volume =
JQUery has a .parents() method for moving up the DOM tree you can start there.
If you're interested in doing this a more semantic way I don't think using the REL attribute on a button is the best way to semantically define "this is the answer" in your code. I'd recommend something along these lines:
and
$("button").click(function () {
var correctAnswer = $(this).parent().siblings("input[type=hidden]").val();
var userAnswer = $(this).parent().siblings("input[type=text]").val();
validate(userAnswer, correctAnswer);
$("#messages").html(feedback);
});
Not quite sure how your validate and feedback are working, but you get the idea.