Text formatting options for HTML / PHP

Asked

Viewed 436 times

-1

I wonder if you have any script or something related where I can add on top of my text-area (Image 1) a tab of formatting for the text. How it is used in Stackoverflow itself for question creation (Image 2).

Image 1 Imagem 1

Image 2

Imagem 2

1 answer

2


Yes, there is!

I like to use the Froala Editor

After adding all the dependencies to your project, simply set your textarea as an input that will use the editor library.

Suppose you have a textarea like this:

<textarea id="resumoAtividades"></textarea>

You only need to do this on your JS:

<script>
        $(function() {
                $('textarea#resumoAtividades').froalaEditor()
        });
</script>

But there are several other alternatives:

The Ckeditor is also super known, is Opensource and the way to use is similar to Froala.

To find other alternatives, look for textarea editor on Google.

  • What I am doing is then exporting what was written in PDF, to keep the formatting done it accepts the <pre> ?

  • @Matheusmartins, you can do this quietly! I can’t tell you for sure if in the free version of Froala they allow you to use <pre>, but in the worst case scenario, you add it manually. Anyway, there are similar, free tools that do the same thing as Froala, updated the answer giving other alternatives.

  • 1

    Oh right, I was looking for this for a long time, but I didn’t find anything about it, I searched for formatting but only things like formatting text by haha tags. Thank you.

Browser other questions tagged

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