PHP text that is changed in the textarea field when exiting the modal, the text does not return to the original, why?

0

Good Afternoon

I'm using Bootstrap's Varying modal content based on trigger button to create a product edit window.

link

I have a textarea field that is not showing the information, the input field works correctly, only the textarea field does not load the information, so I did

 <textarea> <?php echo $informacao; ?> 

It worked but if the user opens the modal and changes something of textarea when leaving and returning the change is still there.

How can I solve these problems, when leaving the modal any change that has been made, votes everything to what was loaded from the database.

    
asked by anonymous 28.04.2017 / 20:27

1 answer

0

So this happens because the modal is generated on your page while the page loads and not when the .show() method is called in javascript. To return the original value of the database you must change the value of textarea when the .show() method is called. Try something like this:

var textarea = document.getElementById('id_do_textarea');
textarea.value = <?php echo $informacao; ?>;
    
28.04.2017 / 20:38