Very small problem - please look

Discussion in 'Programming' started by Site Owner, Jul 27, 2007.

  1. #1
    This just adds text from the textbox to the text area...
    
    <input id="inputtext">
    <input value="Add text" onclick="document.getElementById('textarea').value+=inputtext.value;" type="button">
    <textarea rows="7" id="textarea" name="box" cols="45"></textarea>
    
    Code (markup):
    I need it to add a linebreak after each text is added. How can I make <br> into an element and append it to the onClick?
     
    Site Owner, Jul 27, 2007 IP
  2. pruad

    pruad Peon

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <input id="inputtext">
    <input value="Add text" onclick="document.getElementById('textarea').value+=inputtext.value + '\n';" type="button">
    <textarea rows="7" id="textarea" name="box" cols="45"></textarea>
    
    Code (markup):
    hint: I changed inputtext.value to inputtext.value + '\n'
     
    pruad, Jul 27, 2007 IP
  3. Site Owner

    Site Owner Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That worked in a regular page but in Smarty (.tpl file) the the \ gets taken out. :(
     
    Site Owner, Jul 27, 2007 IP
  4. pruad

    pruad Peon

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try to wrap this code with {literal}..{/literal} in Smarty .tpl.
     
    pruad, Jul 27, 2007 IP
  5. Site Owner

    Site Owner Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I had already tried that, it doesn't work here. I do use that on other scripts and it works.
     
    Site Owner, Jul 27, 2007 IP
  6. pruad

    pruad Peon

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I can't help without viewing code =) Share it =) Maybe in PM if you want
     
    pruad, Jul 27, 2007 IP