Question

Okay, I'm pretty much at a loss. I've been doing to for a while and have always found my answer on Stack Overflow or somewhere on the internet. I've never had an issue I've actually had to ask, but this problem is incomprehensible to me.

I have this bit of javascript:

if($(".cmsArbitForm .nicEditor", this).is('*'))
{
    for(var i=0;i<nicEditors.editors.length;i++){
        nicEditors.editors[i].nicInstances[0].saveContent();
        $('.cmsArbitForm .nicEditor', this).css('display','block').css('position','absolute').css('top','0px');
    }
}

This code executes flawlessly on my local server, but when I put it online I get this error

Uncaught TypeError: Cannot call method 'saveContent' of undefined

I don't understand how this can work on localhost but not on the live server given the same website and same browser.

I tried adding -1 after nicEditors.editors.length, which actually worked...until attempting to submit this form a second time. On the second try I got the same error again. I'm totally at a loss, so any help would be greatly appreciated. I'm new to asking on SO, so if I'm doing anything wrong, please let me know. Thanks

Was it helpful?

Solution

Okay, well I figured it out and I feel bad because I don't think it's possible anybody would have been able to figure this out without knowing and understanding the entirety of my of my 1500 line long code. I can't be too specific (it would take too long to explain everything), but long story short, another bug which was causing some of my textareas which nicEdit was supposed to make instances of, did not exist. This was causing nicEdit to be referencing instances which had no content to save because they did not exist. I have everything fully working now.

I want to thank the Stack Overflow community, however, for how kind and helpful they were. Thanks for your time, everyone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top