Click here to Skip to main content
16,007,932 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi,

I am using TinyMCE editor in my project. I want to Editors value using Javascript.
I have searched on google and got below code:

tinyMCE.activeEditor.getContent()

tinyMCE.get('editor1').getContent();



but while using this code I am getting error as

JavaScript runtime error: Unable to get property 'getContent' of undefined or null reference

aslo I tried

$("#PrevBCC").text($("#<%= Editor1.ClientID %>").val())

to display value in Span (PrevBCC) but value is blank
Posted

1 solution

It simply means that you don't have an active editor, and no editor named "editor1". You probably did not instantiate any. This error message is the usual message shown when you try to use undefined object (never initialized variable, for example), or null.

That's all one can see from your information. If you need some more, you would have to create and show some self-consistent code sample.

—SA
 
Share this answer
 
Comments
rajgaikwad01 14-Mar-14 11:47am    
Hi Sergey,

My page is having editor with Id: "editor1".
I am getting the value on code behind but not in the Javascript written on the same page
Below is the Control code:
<asp:TextBox ID="editor1" runat="server" ClientIDMode="Static" TextMode="MultiLine"
Rows="30" Style="width: 60%" CssClass="tinymce" />
Sergey Alexandrovich Kryukov 14-Mar-14 11:49am    
Not clear. What code behind? This is a pure HTML/Javascript editor, all in client side.
Without any code sample, it's hard to understand what have you done.
—SA
rajgaikwad01 14-Mar-14 11:52am    
I used it as a Server control by adding runat="server" to it.
I tried by removing runat="server" also but having same issue.
Sergey Alexandrovich Kryukov 14-Mar-14 12:09pm    
???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900