Gilles (Webunity) wrote:
Well i've tried that one off course, but the problem is that i don't
know, how much markup comes before the <div class="formError">
So i tried this as well;
jQuery('.formError:first', this).prev(':input')
but that doesn't work, even though the docs state it should work.
I think that only picks the previous element (whatever it is) and then
filters it out if it is not an input field. So that won't do.
It is pretty difficult to answer your question without seeing some sample
html structure. If the input field and the error div are siblings, but are
not siblings to other input fields or errors, then you could propably use
jQuery('.formError:first', this).siblings(':input:first') or since there
should be no other inputs on this level of the hierarchy, just use
jQuery('.formError:first', this).siblings(':input)
Another easy way would be to modify your PHP code so that it gives a
specific class to the input fields that have an error, and use that to
select them.
If those won't do, I'd suggest you post some sample html to work with.
--
Suni