Using Baidu's UEditor, the content of textarea cannot be obtained using jquery at the front end.

Source: Internet
Author: User
Using Baidu's UEditor, the content code of textarea cannot be obtained using jquery on the front end: & lt; textarea & nbsp; name = "filecontent" & nbsp; id = "filecontent" & nbsp; & gt; & amp; nbsp; & lt;/tex using Baidu's UEditor, the content of textarea cannot be obtained using jquery at the front end.
The code is as follows:

 


 
  
    var editor = new UE.ui.Editor();
    editor.render("filecontent");

$('#insert_file').click(function(){
    var filecontent = $('#filecontent').val();

         alert(filecontent);
});
《script》

------ Solution --------------------
He has a demo. There are a lot of buttons in the demo that can be clicked to get various content...
Then you can simply use his method.
------ Solution --------------------
Get the editor content
Editor. getContent ()

Although filecontent identifies textarea
But the actual editor is in an ifarme
------ Solution --------------------

Reference:
Reference: get the editor content
Editor. getContent ()

Although filecontent identifies textarea
But the actual editor is in an ifarme
Thank you for solving the problem. but if you need to modify the old article, how should we re-put the data into the editor? Because I use ajax to retrieve data, I don't know how to re-add the data to the editor, because it is always unsuccessful ......


You need to see if JavaScript is correct and the content needs to be escaped.
------ Solution --------------------
Editor. setContent (content to be inserted)

Reference:
Reference: get the editor content
Editor. getContent ()

Although filecontent identifies textarea
But the actual editor is in an ifarme
Thank you for solving the problem. but if you need to modify the old article, how should we re-put the data into the editor? Because I use ajax to retrieve data, I don't know how to re-add the data to the editor, because it is always unsuccessful ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.