The problem was that it was only checking for button to use html instead of val, what you need is to only use val if it it's an input and use html for everything else.