question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to populate editor once initialised via jquery

See original GitHub issue

Am having trouble populating the editor after it has been initialised.

The documentation says you can access the instance and write to it via something like.

$('#textarea-id').wysihtml5().data("wysihtml5").editor.setValue('test');

However this only populates the hidden <input type="textarea"> as opposed to the editor itself.

If I go to the demo (http://xing.github.com/wysihtml5/examples/advanced.html) and execute …

editor.setValue("foobar");

… then the editor gets updated and shows “foobar”. Correctly.

I can use the editor.setValue as above to populate the editor, but I have multiple editors on a singe plage, so ideally i’d use the first scenario where i can target the instance I want to write to.

Any advice/suggestions?

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
gabisajrcommented, Aug 20, 2016

I had a few issues with this until I found this solutions

$('iframe').contents().find('.wysihtml5-editor').html('your new content here');

0reactions
DanielnetoDotComcommented, Feb 23, 2018

thanks @gabisajr that was the only solution for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

JQuery DataTables - Add Editor buttons after initialised
This works in case others are wanting to do the same. var permission = $( '#permission_field' ).val(); var table = $( '#my_table' )....
Read more >
Populating Editor via Jquery in UI for ASP.NET MVC - Telerik
I am able to populate Editor programmatically from my model using Alexander's code snippet from ...
Read more >
Adding buttons after load. — DataTables forums
I'm just trying to add these standard buttons after the initialise: buttons: [{extend:'remove', editor: editor},{extend:'create', ...
Read more >
wp.editor.initialize not working as expected
find('label').each(function() { if (jQuery(this).attr('for')) { var oldFor = jQuery ...
Read more >
How to add Summernote Editor in webpage ? - GeeksforGeeks
Create an index.html file & declare the Bootstrap & jQuery links inside the <head> tag. After completing these steps, the project structure ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found