Manish Goswami
Manish Goswami

Reputation: 875

How to set content inside HtmlEditorExtender on page load

I want to set content on Page Load inside HtmlEditorExtender

<asp:TextBox runat="server" ID="txt_plbNtCom" Height="300px" Width="99.8%" TextMode="MultiLine"></asp:TextBox>

<asp:HtmlEditorExtender TargetControlID="txt_plbNtCom" ID="ed_plbntcom" runat="server"></asp:HtmlEditorExtender> 

JQUERY

var htmlEditorExtender = $('.ajax__html_editor_extender_texteditor');
console.log(htmlEditorExtender);
htmlEditorExtender._editableDiv.innerHTML = "something";

I am getting null in Console.

Upvotes: 3

Views: 855

Answers (2)

Sasha Truf
Sasha Truf

Reputation: 565

Look here, it may be useful: https://taditdash.wordpress.com/2014/03/05/set-content-inside-ajax-htmleditor-and-editorextender-using-javascript/

var htmlEditorExtender = $('.ajax__html_editor_extender_texteditor');
htmlEditorExtender.html("something");

Upvotes: 0

Dhrumil
Dhrumil

Reputation: 3204

Try using getElementById() to first, catch the control that you want to edit and then try setting the innerHTML for that. Something like this should get you through :

<script type="text/javascript">
var x = document.getElementById("yourControlId");
x.innerHTML = "somethingSomething";
</script>

Also, make sure your control is loaded before you call this or you can use $( document ).ready() wrapper on this.

Hope this helps.

Upvotes: 4

Related Questions