jQuery UI dialog title with icons or auto close timer

Countdown timer with jquery ui dialog auto close
jQuery ui remove dialog close button
var dialog = $("#dialog").dialog({
    modal: true,
    closeOnEscape: false,
    title: '<span class="ui-icon ui-icon-home"></span> Example Dialog',
    open: function (event, ui) {
        //hide close button.
        $(this).parent().children().children('.ui-dialog-titlebar-close').hide();
    }
});

var interval = setInterval(function () {
    var timer = $('span#time').html();
    timer = timer.split(':');
    var minutes = parseInt(timer[0], 10);
    var seconds = parseInt(timer[1], 10);
    seconds -= 1;
    if (minutes < 0) return clearInterval(interval);
    if (minutes < 10 && minutes.length != 2) minutes = '0' + minutes;
    if (seconds < 0 && minutes != 0) {
        minutes -= 1;
        seconds = 59;
    } else if (seconds < 10 && length.seconds != 2) seconds = '0' + seconds;
    $('span#time').html(minutes + ':' + seconds);

    if (minutes == 0 && seconds == 0) {
        clearInterval(interval);
        $(dialog).dialog("close");
    }
}, 1000);
jQuery UI dialog title with icons or auto close timer jQuery UI dialog title with icons or auto close timer Reviewed by Bhaumik Patel on 7:33 PM Rating: 5