Martin,

Check out the Field plug-in:

http://jquery.com/plugins/project/field

This provides the type of functionality you're looking for (of providing
form values back for any type of field.)

-Dan

>-----Original Message-----
>From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>Behalf Of mar10
>Sent: Thursday, June 12, 2008 3:17 AM
>To: jQuery (English)
>Subject: [jQuery] Best practice to get form field values
>
>
>Hi,
>
>what would you consider the 'best practice' to access form input
>values?
>
>Having an input field
>    <input value="New topic" class="inputEdit" name="title"
>type="text">
>I could use
>       $('[EMAIL PROTECTED]').val()
>or
>       $('[EMAIL PROTECTED]"title"]').val()
>or
>       $('[name=title]').val()
>or
>       $('[name="title"]').val()
>
>(
>I also once observed, that the right side of the '=' was evaluated, so
>it was possible to write
>    var x = 'title';
>    $('[name=x]')
>but i could not reproduce it today, so maybe I'm wrong.
>)
>
>Of course assigning an additional id
>    <input value="New topic" class="inputEdit" name="title"
>type="text" id="title">
>would allow for
>    $('#title')
>but that appears to be somewhat redundant to me.
>
>In short I am looking for the most simple built-in syntax to access
>form values, like prototype's $F().
>This means that querying option lists should return a list of selected
>values (or texts), and text areas should work also.
>
>
>Thanks
>Martin

Reply via email to