How would I use JQuery or JS to change the content of a div that is in an HTML module that is open in Edit Content mode?
I have tried creating a div with an id like
[div id="ChangeMe"]This text will be replaced.[/div]
and using the standard JQuery statement
$('#ChangeMe').html('Changed');
This works when the HTML module is not in Edit Content mode but does not work if the module is in edit mode, which is where I need it. I suppose it might be a scope issue, but I do not know how to address the issue. Any other way to change the text in edit mode is also welcome. Thanks in advance!
Michael TobischDNN★MVP
Posted By Mark Buelsing on 28 Oct 2020 01:01 PM I'm using an Action Form. The DNN Text Editor in an Action Form is an html module in edit mode. My user is pulling multiple pieces of content into the editor from the user's custom tables and then stays in edit mode so the user can change the document text, highlight and underline and such, and when finished they will click a button that grabs their content from the DNN Text Editor and produces a formatted PDF. In order to pump a piece of content from a record into the DNN Text Editor in just the right location in the existing content without replacing the entire contents of the editor, I'm placing an anchor or div with an ID in the content, and then need to use jquery/JS to put the incoming content into the html of the named div. Basically I'm creating a pdf generator that pulls from user data that can be tweaked by the user. I'm liking it so far.
I think a custom CkEditor plugin (although not very simple) would be the most reliable way to do this.
Just a few moments ago I figured out how to paste a unique string ( a token) into the document in the editor in any particular place that I need it, and then click a button that replaces the token with a new content section from the database using a "Replace" feature in the form. So the mission is accomplished and no JS/Jquery is needed this time.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.