I Need Help...

Discussion in 'PHP' started by sonu21, Jun 1, 2012.

?

Do you think it is possible?

  1. Yes

    0 vote(s)
    0.0%
  2. No

    0 vote(s)
    0.0%
  3. Might Be

    0 vote(s)
    0.0%
  1. #1
    Hello Friends, I need your help.Please see the attached image.I want to copy the TextBox text to TextArea but not in the complete text box.Like I had showed in the image.Its little challenging though.Because,I had searched all over but didn't solution for this.I think it only be possible with PHP.

    Hope Get the Solution Soon...
     

    Attached Files:

    Solved! View solution.
    sonu21, Jun 1, 2012 IP
  2. #2
    Hi,

    I am not sure whether I completely get your issue.

    But here's what I have done for you:

    jQuery Code:
    // the original msg
    var msg = "Hello {name}, welcome to DP. How are you ?";
    
    $(document).ready(function(){
        // when user types something in the textbox
        $('#username').keyup(function(){
            var uname = $(this).val();  // get the value typed in it
            $('#msg').val(msg.replace('{name}', uname)); // insert the name in msg and display it
        });
    });​
    Code (markup):
    HTML:
    Name: <input type="text" id="username" /> 
    <br />
    Msg: <textarea id="msg"></textarea>
    Code (markup):
    Here's the fiddle for online testing: http://jsfiddle.net/9kFLU/

    Hope it helps :)
     
    akhileshbc, Jun 1, 2012 IP