re: the second part.
Do you mean something like:
$("input").next().remove();
or
$("input").siblings("div.error").remove();

You can see different ways of achieving the same goal depending on your
structure and circumstances.

Glen


On 5/23/07, cliff <[EMAIL PROTECTED]> wrote:


I am new to jQuery and have several questions:

1. To access a form element, I use: document.forms[frmname]
[elementname]
          What is the jQuery equivalent?
          Will there be any significant speed difference between the
old and jQuery way?

2. This is basically the same as #1. I am getting the hang of
accessing elements by id using $("#elementid"), but how do I access
form elements by name so I can avoid using ids.

3. I want to strip error messages after an input element --
essentially just stripping DOM siblings after the input element. See
function below:

function removeNextSiblings(elementid) {
        var element = document.getElementById(elementid);
        var parent = element.parentNode;
        while (parent.lastChild) {
                if (parent.lastChild == element)
                        break;
        parent.removeChild(parent.lastChild);
        }
}

Is there a shorter jQuery way to do this function. Ideally, it could
start with a reference to the source element object instead of an
elementid so I can avoid the use of ids in form elements.

And of course, what's the advantage to the jQuery way? Less code?
Slickers?
Cliff


Reply via email to