You should abstract `$("#questionsdisplay")` into an external var so jq doesn't have to traverse the dom every time to refind the element every time you call generate questions, and the other two times its called.