Since dlg is a jQuery object, we should use $ prefix for the variable name. I know it's not your code, but you can clean it up for consistency with the way we name our variables.