How to hide a div if validation summary is available in javascript/Jquery.
+2
A:
if(yourCondition){
$("div#mydiv").hide()
}
what is validation summary?
mkoryak
2010-05-27 14:58:11
Usually a validation summary is a div or block that contains all the error messages generated by a group of validation controls in some kind of list form.
Steve
2010-05-27 16:00:46
any good ideas ???
George
2010-05-27 16:02:41
IIRC, the validation summary is in a div. mkoryak's solution should work.
Steve
2010-05-27 19:50:08
Set the validation summary's cssclass to say zzz. Then you can do mkoryak's sol'n. if (".zzz") { ...
Steve
2010-05-27 19:58:44
A:
var validationSummary = $('#<%= this.ValidationSummary.ClientID %>');
var myDiv = $('#myDiv');
if (validationSummary.length || validationSummary.is(':visible')) {
myDiv.hide();
}
the cause for .is(':visible')is, that i don't know if an empty validationSummary renders the html-tags either or not. if not, you can leave out the .is()-check
Andreas Niedermair
2010-07-19 20:17:58