On Nov 17, 2007 12:31 PM, kenq <[EMAIL PROTECTED]> wrote:
> The following alert($('city').value) returns undefined. The alert($
> ('zip').value) returns 'zip' and $('city').update works fine also.
Non-form elements don't have a "value" attribute, so $('city')--or
$F('city') for that matter--don't have anything to return. Since
$('zip') _is_ a form element (an input), it returns the value of the
input. Update works because update's not working on the value of the
element, it's working on the children of the element, that is, the
element's contents--but those contents aren't the value of the
element.
If you want to access what's in $('city'), you've got to do something
like $('city').firstChild.nodeValue, or just $('city').innerHTML.
:Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---