need copy text box to show all of text, and perhaps vary size to easily replace the quote

  • The html code below allows someone to copy the text in the text box, but does not show the entire text in the best box which I need it to do. Ideally, I would like to be able to easily change out the quote and have the text box automatically match the size of the quote. Thanks in advance!!!


    <p>Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.</p>


    <input type="text" value="Success isn't always about having everything you need. It’s about using your resources and circumstances to the fullest extent. #creativitymatters #successquotes #sundayvibes" id="myInput">

    <button onclick="myFunction()">Copy text</button>


    <script>

    function myFunction() {

    // Get the text field

    var copyText = document.getElementById("myInput");


    // Select the text field

    copyText.select();

    copyText.setSelectionRange(0, 99999); // For mobile devices


    // Copy the text inside the text field

    navigator.clipboard.writeText(copyText.value);


    // Alert the copied text

    alert("Copied the text: " + copyText.value);

    }

    </script>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!