Please note that it's the opposite of the usual question.
I have a function that adds a score to a control recognized by a certain guid. The problem is that the upper limit is stored in the model of the Razor page. I need to get to it using the guid that I've got from my button's ID.
@Model.Answers.Single(=>.Id==HERE BE THE JS GUID).Max
The guid is $(invoker).attr("id").substr(3)
The code of the function looks like this. I can'f for my life figure out the syntax to get it it there.
function adjustScore(invoker, delta) {
var target = $("#val" + $(invoker).attr("id").substr(3));
var newValue = +target.html() + delta;
var max = @Model.Answers.Single(_=>_.Id == new Guid()).Max;
if (newValue < 0 || newValue >= max)
newValue = 0;
target.html(newValue);
}