To access a form element by name: $('[EMAIL PROTECTED])
-----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cliff Sent: Wednesday, May 23, 2007 10:52 AM To: jQuery (English) Subject: [jQuery] Conventional JS/DOM to jQuery conversion help 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