Can not work, my fade disappears when I display the success message


Could not working my fade in fade out when i displaying success message onsubmit function:

Here is my Javascript:

popUpForm = function() {
    jQuery('#successMessage').text("Successfully submitted !").fadeIn("slow")
    jQuery('#successMessage').css("display", "block")

    setTimeout(function() {
        jQuery('#successMessage').css("display", "none")
    }, 5000);
</script>  And Here is my message block div: <div th:id = "successMessage"  class="alert-box success"></div>

See using following code am not sure.

var auto_info = setInterval(function() {
        $("#successMessage").text("Successfully submitted !").fadeIn("successMessage");


    setTimeout(function() {
    }, 5000);