I have buttons with a class named nav, when a button is clicked the ID is read and the variable \"pre\" is set to the ID. Once the variable is set I\'m removing part of the id,
You don't need the quotes around it, that's the problem.
$('#'+ pre)