Hi,
I want to call a javascript function after my page has loaded.
Currently I am using:
<body onload="do_stuff()">
Is there a neater / tidier way to do this using any rails specific
commands?
I found this:
document.observe('dom:loaded', function() {
$('state_field').hide();
$('person_country_id').observe('change', countrySelected);
});
which is part of a tutorial for creating dynamic drop down menus, but
when I, for example, try:
document.observe('dom:loaded', function() {
alert('hello');
});
this has no effect, rather it is output as html, as though I had witten
<p>document.observe('dom:loaded', function() {alert('hello');});</p>
Grateful for any help.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---