0

I have a textarea that receives a variable via php

  $boring = str_ireplace($boringa, "\r\n", $boring);

That variable is then chaged via js

 $(document).ready(function(){
    $("a.clickable").click(function(event){
        event.preventDefault();
        $("textarea#messageforfriends").val($(this).html());
    });  
});

So the textarea receives the new variable fine in everything but IE (of course) the br tags are being taken out?

2 Answers2

0

There are differences in the way IE handles linebreaks in textareas. Here are a couple of earlier posts you may find helpful.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
SourceMaid
  • 473
  • 3
  • 6
0

Usually IE ignores the type of (repeated)whitespaces and internally replaces them with a single space (%20). This happens in most of elements(because the whitespaces make no sense there for the rendering), except <pre> and <textarea> .

So if it is an option, use a <pre/>-element instead of an <a/>

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201