The problem is that Numbas doesn't use jQuery any more, so the $() function doesn't exist.
You can fix your question by changing $(question.display.html).find('#dragpoint').append(div); to question.display.html.querySelector('#dragpoint').append(div);
But I'd like to encourage people not to make JSXGraph diagrams in the preamble, now that you can build them as question variables.
The benefit of defining a diagram as a variable is that it doesn't rely on fiddly JavaScript things, and you don't have to think about things like how the state of interactive diagrams gets saved and restored - the extension can take care of it for you.