Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
How to get value from WYSIWYG with Javascript or using the help of JQuery maybe?

I want to ask. I wanted to create a blog, but used a Microsoft word-style text editor. If suppose using vanilla javascript or pure javascript or using the help of JQuery?

MY code:

<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
    <!-- CDN WYSIWYG (TINYMICE) -->
    <script src="https://cdn.tiny.cloud/1/fjxlmvgx0f36t65lwkpdwdyrxxahi85ni9wp3e2xp17gjitr/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
</head>
<body>
    <!-- Text-Area -->
    <textarea id="my_text"></textarea>
    <!-- Button Get Value -->
    <button id="value_button">Get Value</button>

    <script>
        // Install WYSIWYS (TINYMICE)
        tinymce.init({
            selector: 'textarea',
            plugins: 'a11ychecker advcode casechange export formatpainter image editimage linkchecker autolink lists checklist media mediaembed pageembed permanentpen powerpaste table advtable tableofcontents tinycomments tinymcespellchecker',
            toolbar: 'a11ycheck addcomment showcomments casechange checklist code export formatpainter image editimage pageembed permanentpen table tableofcontents',
            toolbar_mode: 'floating',
            tinycomments_mode: 'embedded',
            tinycomments_author: 'Author name',
          });

        // Dom (get id:my_text & value_button)
        let my_text = document.getElementById("my_text");
        let value_button = document.getElementById("value_button");

        // get value in console
        value_button.addEventListener("click",()=>{
            console.log(my_text.value)
        })
      </script>

I want to get the value first. Like wanting to write "Thursday"

Perhaps, what appears is "<p>Thursday</p>"

My obstacle, I typed whatever the value is ""(empty)

Note: My WYSIWYG is TinyMice

However, if you have another type of WYSIWYG, I will try it Thankyou

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

TinyMCE has an API to get its current content:

getContent() - https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#getcontent

For some background, when you load TinyMCE it overlays your textarea with an iframe so when you are typing into TinyMCE you are not updating the textarea.

That being said, there is an API call to make TinyMCE push its current content back into the textarea:

triggerSave() - https://www.tiny.cloud/docs/api/tinymce/root_tinymce/#triggersave

...so if you need to do something specifically with the textarea you can call triggerSave() first.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda