Updated the JavaScript to handle the new hidden buttons until something is selected