Forums

Home » Liferay Portal » English » Liferay Legacy

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Brett Conoly
jQuery(document).ready() and window.onload
September 11, 2007 11:33 AM
Answer

Brett Conoly

Rank: Regular Member

Posts: 121

Join Date: July 19, 2007

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
Brett Conoly
RE: jQuery(document).ready() and window.onload
September 14, 2007 5:06 AM
Answer

Brett Conoly

Rank: Regular Member

Posts: 121

Join Date: July 19, 2007

Recent Posts

Anyone, and if I'm wrong in this theory feel free to tell me.
Thanks
James Hong
RE: jQuery(document).ready() and window.onload
September 14, 2007 12:57 PM
Answer

James Hong

Rank: Regular Member

Posts: 115

Join Date: May 22, 2007

Recent Posts

You are wrong emoticon
James Hong
RE: jQuery(document).ready() and window.onload
September 14, 2007 12:47 PM
Answer

James Hong

Rank: Regular Member

Posts: 115

Join Date: May 22, 2007

Recent Posts

Here is a simple test. Just create this web page:

 1
 2<html>
 3<head>
 4  &lt;script type="text/javascript" src='/html/js/jquery/jquery.js'/>
 5  &lt;script>
 6  window.onload = function () {
 7    alert("onload");
 8  }
 9
10  $(document).ready(function() {
11    alert("ready");
12  });
13  &lt;/script>
14</head>
15<body>
16Some text
17</body>
18</html>


I get both alerts.

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

James
Brett Conoly
RE: jQuery(document).ready() and window.onload
September 14, 2007 10:34 AM
Answer

Brett Conoly

Rank: Regular Member

Posts: 121

Join Date: July 19, 2007

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
James Hong
RE: jQuery(document).ready() and window.onload
September 14, 2007 12:56 PM
Answer

James Hong

Rank: Regular Member

Posts: 115

Join Date: May 22, 2007

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
Brett Conoly
RE: jQuery(document).ready() and window.onload
September 14, 2007 1:00 PM
Answer

Brett Conoly

Rank: Regular Member

Posts: 121

Join Date: July 19, 2007

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.
Brett Conoly
RE: jQuery(document).ready() and window.onload
September 18, 2007 10:04 AM
Answer

Brett Conoly

Rank: Regular Member

Posts: 121

Join Date: July 19, 2007

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.