Results 1 to 6 of 6

Thread: [RESOLVED] jquery display text

  1. #1
    Addicted Member
    Join Date
    Jan 09
    Posts
    225

    Resolved [RESOLVED] jquery display text

    hi gurus,

    need your help. I had tried making this simple html with jquery.

    I want to display the text on the input button to the text area simultaneously.

    how do i do it? please check code below which I had started. Thank you.

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    
    <style>
     <script src="http://code.jquery.com/jquery-latest.js"></script>
    </style>
    
    </head>
    
    <body>
    
     <form>
      <fieldset>
        <label for="target">Type Something:</label>
        <input id="target" type="text" />
      </fieldset>
    </form>
    
    <form name="display_form">
    
    <textarea id="txtdisp" rows="2" cols="20">
    
    </textarea>
    </form>
    
    <script> 
     
    var txt= $("#target").val();
    
     onKeyUp="display_form.form.txtdisp.value=txt";
    
    </script>
    
    </body>
    </html>
    The taller the bamboo grows the lower it bends...

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 08
    Location
    Trivandrum, Kerala, India
    Posts
    7,559

    Re: jquery display text

    Try this:
    Code:
    <script> 
      $(document).ready(function(){
        $('#target').keyup(function(){
          var txt= $(this).val();
          $('#txtdisp').val(txt);
        });
      });
    </script>
    To test it live, check this fiddle: http://jsfiddle.net/4zrZg/


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater

    Social Group: VBForums - Developers from India

    Skills: PHP, MySQL, jQuery, VB.Net, VB6, Photoshop...

  3. #3
    Addicted Member
    Join Date
    Jan 09
    Posts
    225

    Re: jquery display text

    hi akhileshbc, thanks for your help.

    it works on the fiddle url that you posted.

    but when I tried to save the file as an html file, it doesn't work.

    anything i'm missing? thank you.
    The taller the bamboo grows the lower it bends...

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 08
    Location
    Trivandrum, Kerala, India
    Posts
    7,559

    Re: jquery display text

    Are you trying to save the html file in the fiddle, just by choosing the Save As option from your browser ?

    If you want to copy the code from the fiddle, just copy that code and paste it in a new html file. That's all !


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater

    Social Group: VBForums - Developers from India

    Skills: PHP, MySQL, jQuery, VB.Net, VB6, Photoshop...

  5. #5
    Addicted Member
    Join Date
    Jan 09
    Posts
    225

    Re: jquery display text

    hi akhileshlbc, thanks it works!

    it does not work because of the style tag:

    <style>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    </style>

    but it works if i removed the <style> </style> tag.

    Thanks again
    The taller the bamboo grows the lower it bends...

  6. #6
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 08
    Location
    Trivandrum, Kerala, India
    Posts
    7,559

    Re: [RESOLVED] jquery display text



    Good luck

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater

    Social Group: VBForums - Developers from India

    Skills: PHP, MySQL, jQuery, VB.Net, VB6, Photoshop...

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
  •