Selecting problems else if
Hi,
i'm relative new to jQuery and for me the hardest part is allways to get the right elements.
Ok, i have a form and in this form i have a lable (id="hint") after sending the form above the form a div shows up.
If everything is ok the div looks like that
- <div id="results"><p></p></div>
if theres an error
- <div id="results"><p class="error"></p></div>
I want to hide the <lable id="hint"> and the form if there is <div id="results"><p>
If there is <div id="results"><p class="error"> i just want to hide the <lable id="hint">
This works if theres an error and hides the hint
- if ($("div#results p.error").length) {
- $('#hint').hide();
- }
But how to check for #results without p class="error"?
- if ($("div#results p.error").length) {
- $('#hint').hide();
- }
- else if {
- $("div#results but p not class error").length) {
- $('#hint, form').hide();
- }