Unless jQuery 1.3 has made vast improvement in the "name=Xxx" functionality, it is *horrendously slow*! I use a custom function to access form-fields - $F("fieldName") - which is up to 1000-times faster on large pages in my web-application. But this method is dependant on other custom methods, so I cannot provide it here as a stand-alone plug-in..
I wish/hope jQuery will soon provide an efficient way to access form- fields 'by name' because using IDs on form-fields is a clumsy hack that I refuse to use except in special cases. On complex, dynamically generated form pages, it clutters the code and requires extra logic to add sequential IDs to things like radio buttons. So this is not a proper solution to a common need. /Kevin On Feb 6, 2:27 pm, James <james.gp....@gmail.com> wrote: > Without using IDs, you can use: > > var myVar = $("input[name=myHiddenInput]").val(); > > On Feb 6, 10:54 am, james <noahk...@gmail.com> wrote: > > > > > Hi, > > > If I have a form: > > > <form name="myForm" method="post" action="myAction.php" > > onsubmit="javascript:doStuff()"> > > <input type="hidden" name="myHiddenInput"/> > > <input type="text" name="myNonHiddenText"/> > > <input type="submit" value="submit"> > > </form> > > > What is the equivalent JQuery syntax for the following? > > > function doStuff() { > > document.myForm.myHiddenInput.value = 'some dynamic var'; > > return true; > > > } > > > Thanks in advance, > > James- Hide quoted text - > > - Show quoted text -