Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
populate with text from an ajax call (json)
posted

Im retrieving some text via an ajax call (Json) and want to populate the html editor with this text.  The html editor is inside a form.  I cant get it to work.  I get an instance of the form, then try to locate the html editor within that form and finally place the data inside it.  Heres the code ive used so far

var frm = document.querySelector("#frmAddDisclaimer");

                   
                    if ("htmlEditorDisclaimer_editor" in frm.elements) {
                        frm.elements["htmlEditorDisclaimer_editor"].value = data.DisclaimerText;
                    }

the frm varaibale exists and has properties and data.DisclaimetText has text in it, but the control isnt being populated.  How can I do this ?

Parents
No Data
Reply
  • 975
    Offline posted

    Ive changed the code to this

    if ("htmlEditorDisclaimer_source" in frm.elements) {
                            frm.elements["htmlEditorDisclaimer_source"].value = data.DisclaimerText;
                        }

    which does find the control in the form and assigns it the value in data.DisclaimerText

    but the control is still empty, no text is displayed

Children