4 lines down to 1! Works perfectly; I didn't know you could do some of
those things. I've only been working with javascript/jQuery for a few
days.
- Errors are the only things in the ul.errors list
- .NET handles the hiding/showing of the span's. It does it in a way
that I'm not really sure if I can augment (yet. still working on it)
Hiding is working fine. You're right, since my code hides LI's on
pageLoad (via my js) and span's are being hidden/shown continuously
(via .NET's 'magic' on onBlur) -- my error's are not showing due to
LI's being hidden.
Any idea how I can loop through the page to continuously monitor spans
and detect if they've been shown/hidden, then show/hide my LI's in
response?
On Oct 17, 5:20 am, Wizzud <[EMAIL PROTECTED]> wrote:
> I'm not sure how much this is going to help, given that my knowledge
> of ASP.NET is zilch but...
>
> As an aside, from jQuery v1.2, your initial page load code could be
> simplified to ...
>
> $('ul.errors li:has(span:hidden)').hide();
>
> But ... I get the impression that the errors are the only things in
> the ul.errors li structure?
> If so, why hide the errors (the spans) themselves?
> Why not just hide/show the relevant li, leaving the span visible?
> Or is this governed by ASP?
>
> If you are hiding the li parents of hidden spans at page load, then
> the onblur activation of the hidden error message must be making the
> parent li visible as well, otherwise you wouldn't be able to see the
> error. Equally obviously, something must be hiding the error messages
> when not needed or you wouldn't be asking the question in the first
> place. So if the 'show'er is capable of showing the parent li, why
> can't the 'hide'r be capable of hiding the parent li?
>
> Whatever is doing the show/hide of the errors themselves (the spans)
> also needs to do the show/hide of the list item parents.
> Or it needs to be able to kick off a function that does it (same as
> your initial page load code).
> Or maybe trigger a custom event that will do it.
>
> Just thinking out loud.
>
> On Oct 16, 8:29 pm, rich <[EMAIL PROTECTED]> wrote:
>
> > (Using jQuery w/ ASP.NET 2.0)
>
> > I have a few error prompts that are in hidden spans inside <li>'s. I
> > need to hide the LI's when the error prompt is hidden.
>
> > Example:
> > $(document).ready(function() {
> > //hide empty error spans
> > $('ul.errors li span').each(function(i){
> > if($(this).css("display") == "none") {
> > $(this).parent().hide();
> > };
> > });
>
> > });
>
> > This works, but only on page load. These error prompts display as
> > needed on onBlur (via .NET default methods).
>
> > How can I continuously scan the document for these error prompts and
> > show/hide the parent LI's when the prompts show/hide?
>
> > Thanks,
> > -rich