Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
jQuery(document).ready() and window.onload
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
Thanks
Anyone, and if I'm wrong in this theory feel free to tell me.
Thanks
Thanks
You are wrong
Here is a simple test. Just create this web page:
I get both alerts.
BTW, it would be best to avoid onload if possible. query's ready function is a better alternative.
James
<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
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
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
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
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
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.
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.