I'm having trouble getting the right content in my TinyMCE editor. The scenario is like this: Admin fills in a Form, the form is splitted up in 3 pages (switching with jquery). First page he enters the information (name, company name etc.) of his customers. Last page he can send an e-mail to them. The TinyMCE textarea has prefixed text, and in between that text, I want the name of the customer as soon as the admin fills in the name on the first page. It works with
$('input[name="info_name"]').change(function(){
var info_name = this.value;
tinyMCE.activeEditor.setContent(info_name);
});
But then there is no prefixed text, because the text has to be between the prefix. Just a raw example of what I want:
<div page1>
<input name="name">blablabla</input>
</div>
<div page3>
<textarea>
dear $name,
prefix text
</textarea>
</div>
I made a hidden div with the prefix content, and the name of the customer, to extract the total content from the div, and insert it into the TinyMCE, but I keep getting has no method 'replace' in console.
$('input[name="info_name"]').change(function(){
var info_name = this.value;
$('span#info_name').append(this.value);
var mailcontent = $('div#message-hidden').val;
tinyMCE.activeEditor.setContent(mailcontent);
});
Anyone?