added answer to return inside DOM instead of alert box