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

Asked

Viewed 183 times

0

Good Afternoon

I’m using the Varying modal content based on Trigger button from Bootstrap to create a window to edit products.

http://getbootstrap.com/javascript/#modals-Related-target

I have a field of textarea that information is not appearing, the field input works correctly, only the field textarea doesn’t carry the information, so I did

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

worked but if the user opens the modal and changes something from the textarea when leaving and returning the change still remains there.

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

1 answer

0

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

var textarea = document.getElementById('id_do_textarea');
textarea.value = <?php echo $informacao; ?>;
  • Now all the fields are white

Browser other questions tagged

You are not signed in. Login or sign up in order to post.