jQuery(document).ready() and window.onload

thumbnail
33936, modified 18 Years ago. Regular Member Posts: 130 Join Date: 7/19/07 Recent Posts
I'm trying to use the fckeditor with liferay and unfortunately it doesn't work in firefox. I think I've figured out that jQuery's ready() function actually overrides all window.onload functions. Because of this I can't get the editor to work. Does anyone have any ideas on how to get both to work?
Thanks
thumbnail
33936, modified 18 Years ago. Regular Member Posts: 130 Join Date: 7/19/07 Recent Posts
Anyone, and if I'm wrong in this theory feel free to tell me.
Thanks
32081, modified 18 Years ago. Regular Member Posts: 115 Join Date: 5/22/07 Recent Posts
You are wrong emoticon
32081, modified 18 Years ago. Regular Member Posts: 115 Join Date: 5/22/07 Recent Posts
Here is a simple test. Just create this web page:




  <script type="text/javascript" src='/html/js/jquery/jquery.js'/>
  <script>
  window.onload = function () {
    alert("onload");
  }

  $(document).ready(function() {
    alert("ready");
  });
  </script>


Some text






I get both alerts.

BTW, it would be best to avoid onload if possible. query's ready function is a better alternative.

James
thumbnail
33936, modified 18 Years ago. Regular Member Posts: 130 Join Date: 7/19/07 Recent Posts
Are you trying this in liferay, and what version (i'm using 4.3)?
I have gotten a reply from someone in the jQuery forum telling me that jQuery may have fixed this issue in a later release and I'm not sure what version liferay uses.
Unfortunately I can't avoid onload functions because the fckeditor uses them to generate all of its content and that's what's not working in the browser.
Lastly, the only browser that I have a problem with is Firefox, so are you running your test in it?
Thanks
32081, modified 18 Years ago. Regular Member Posts: 115 Join Date: 5/22/07 Recent Posts
Brett -
Sorry the html source code didnt print out properly above. It is correct now. I create a test.html with this source and placed it in webapps/ROOT/html and accessed it in my browser http://myserver.usc.edu/html/test.html. It worked in FF 2.0 and IE 7 for me. BTW I tested this on Liferay 4.3.1.

I recommend creating a static page using FCK editor and try to run it with jquery.ready. Hope this helps.

James
thumbnail
33936, modified 18 Years ago. Regular Member Posts: 130 Join Date: 7/19/07 Recent Posts
Awesome thanks, I'll try it first thing on monday. Don't know why the editor is having problems but thanks again for the help.
thumbnail
33936, modified 18 Years ago. Regular Member Posts: 130 Join Date: 7/19/07 Recent Posts
Thanks for the help, you were right, it is calling window.onload and jQuery(document).ready(). Unfortunately this didn't solve my problem. If you want to know more about it I'm posting the problem again to an fckeditor thread that I have going.