Problem with onload

Rafael Roque wrote:

Hi all, Does someone know why the following code doesn´t work if it is embedded in a partial?in a regular .rhtml file works well.

<script>   document.observe('dom:loaded', function() { alert('testing'); });   </script>

I'm not sure on a quick look. But I do notice a couple of tangential issues that might or might not be related:

* If you're using Rails 2.x, the .rhtml suffix is deprecated. Use .html.erb .

* JavaScript really belongs in separate files, not mixed into HTML. This is especially helpful for code like yours that has to be available before the page is done loading. At the very least, try moving the <script> into the <head> element.

Best,