Well, the issue is as follows, I implemented CKEDITOR in my Laravel project to be able to use images and text format within some textarea. The issue is that before implementing it had a small script that changed the value of textarea by adding predefined text that had on some buttons.
After implementing CKEDITOR, this script does not work correctly, it turns out that it changes the value of the textarea but it does not show it in the CKEDITOR editor. How do I know what the value changes? because when I reload the page of the form, after the refresh magically appears all the values that I was adding with the buttons.
I leave the HTML where the textarea is:
<div class="form-group">
<label>Seleccione los elementos que desee añadir:</label><br>
{{-- HOMBRO --}}
<button type="button" class="btn btn-primary"
onclick="addEFSElement('Usted seleccionó hombro.')">
Hombro
</button>
{{-- PIERNA --}}
<button type="button" class="btn btn-primary"
onclick="addEFSElement('Usted seleccionó pierna.')">
Pierna
</button>
<textarea name="lmr_examenfs" id="lmr_examenfs" rows="8" cols="80" class="ckeditor">
</textarea>
</div>
JavaScript Code:
<script type="text/javascript">
function addEFSElement(text){
var actualText = $("#lmr_examenfs").val();
var newText = actualText +" "+ text;
$("#lmr_examenfs").val(newText);
}
CKEDITOR.replace( 'lmr_encabezado' );
CKEDITOR.replace( 'lmr_antecedentes' );
CKEDITOR.replace( 'lmr_examenfs' );
</script>
I must say that I tried to use the following: link
But it has not worked for me, I also tried different solutions that I found in StackOverflow and they all still do not work, they do not update the textarea in real time as it did before installing CKEDITOR.
I already appreciate your help.