dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Posting string value into text area

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    1

    Posting string value into text area

    I want to post the value of a text box into a text area when I click on a button.

    HTML Code:
      <script>
                
                var newMessage = document.messageForm.User_message.value;
                
                var textBox = document.messageForm.chat_box.value;
                
                function printMessage () {
                    
                    document.messageForm.textBox.value = document.messageForm.User_message.value;
                    
                    
                }
                
            </script>

  2. #2
    Join Date
    Mar 2011
    Location
    The Pleiades
    Posts
    31
    Good afternoon,

    Can you post your HTML also please?

    Kind regards,

    LC.

  3. #3
    Join Date
    Sep 2013
    Posts
    221
    Example:-

    HTML:
    <input type="text" value="This is some text" id="text" style="width: 150px;" />
    <br />
    <input type="button" value="Click Me" id="button" />​

    jQuery:
    <script type="text/javascript">
    $(function () {
    $('#button').on('click', function () {
    var text = $('#text');
    text.val(text.val() + ' after clicking');
    });
    });
    <script>

    Javascript:
    <script type="text/javascript">
    document.getElementById("button").addEventListener('click', function () {
    var text = document.getElementById('text');
    text.text = (text.text + ' after clicking');
    });
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles