function ShowValidationCombinedMessageBox() { var errorText = ""; $("div[class='validationSummary'] > ul > li").each( function(idx, item) { var itemText = jQuery.trim($(item).text()); errorText += "- " + itemText + "\r\n"; } ); if (errorText !== "") { errorText = "The form could not be submitted for the following reasons:\r\n" + errorText; alert(errorText); } } $(document).ready(ShowValidationCombinedMessageBox);