my variable todoHtmlLi is undefined, really can't get it why.. I had declared it early before assign it to some html. I use console.log() to check the priority value, it work just fine..
$(document).on('click', '#addTodoBtn', function () {
    var todoDialog = {
        state0: {
            html: dialogContent,
            buttons: {
                Cancel: -1,
                Add: 0
            },
            focus: 1,
            submit: function (e, v, m, f) {
                e.preventDefault();
                var todoHtmlLi;
                var todoNameVal;
                var todoNoteVal;
                //Task Name
                todoNameVal = $("#todoName").val();
                todoNameVal.trim();
                //Note
                todoNoteVal = $("#todoNote").val();
                todoNoteVal.trim();
                //Priority 
                priority = $("#priority").val();
                if ($(priority) === 1) {
                    todoHtmlLi = "<li style='background:red'><a href='#'>" + todoNameVal + "<input type='checkbox'></a></li>"
                } else if ($(priority) === 2) {
                    todoHtmlLi = "<li style='background:green'><a href='#'>" + todoNameVal + "<input type='checkbox'></a></li>"
                } else if ($(priority) === 3) {
                    todoHtmlLi = "<li style='background:blue'><a href='#'>" + todoNameVal + "<input type='checkbox'></a></li>"
                }
                if (v == 0) {
                    if (todoNameVal !== "") {
                        $("div#tab").find('#todoUl').prepend(todoHtmlLi);
                        $.prompt.close();
                    } else {
                        $("#todoName").focus();
                    }
                } else {
                    $.prompt.close();
                }
            }
        }
    }
    $.prompt(todoDialog);
});
if(v == 0){ mean the 'yes' button is clicked
 
     
    