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