Hi,
I have a problem trying to load HTML into the editor dynamically. I have a select box on the same page as the editor which allows users to load HTML templates into the editor. The value of each option within the select box contains the HTML that needs to be loaded into the editor so I'm using the follwing code to achieve this.
<script type="text/javascript">
function loadTemplate (templateHTML) {
CKEDITOR.instances["campaignHTML"].setData(templateHTML);
}
</script>
<select name="campaignTemplate" id="campaignTemplate" onchange="loadTemplate(this.value);" >
<option value="<strong>HTML for template</strong>">Basic Template</option>
It works fine for simple HTML (as above), however, the problem is when I have more complex HTML within the option value of the select. It causes the editor to not load the HTML correctly because the HTML tags are terminating the value attribute too early so I get left with incomplete HTML loading into the editor. Am I doing something wrong? Is there a better way of getting round this issue?
Any help appreciated.
I have a problem trying to load HTML into the editor dynamically. I have a select box on the same page as the editor which allows users to load HTML templates into the editor. The value of each option within the select box contains the HTML that needs to be loaded into the editor so I'm using the follwing code to achieve this.
<script type="text/javascript">
function loadTemplate (templateHTML) {
CKEDITOR.instances["campaignHTML"].setData(templateHTML);
}
</script>
<select name="campaignTemplate" id="campaignTemplate" onchange="loadTemplate(this.value);" >
<option value="<strong>HTML for template</strong>">Basic Template</option>
It works fine for simple HTML (as above), however, the problem is when I have more complex HTML within the option value of the select. It causes the editor to not load the HTML correctly because the HTML tags are terminating the value attribute too early so I get left with incomplete HTML loading into the editor. Am I doing something wrong? Is there a better way of getting round this issue?
Any help appreciated.