views:

40

answers:

1

Hello,

I have this script to copy multiple value of textbox1 [which are separated by ENTER] to textbox2.

It works perfect in all browser except IE.

In IE all multiple values [which are separated by ENTER] are copied in single line *[without ENTER]* like a single value, Which in turn affecting my form submission.

my code is something like this.

<html>
<head>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;  
</head>  
<body>  

<p>Textarea1</p>    
<textarea name="a" id="ajax" cols="60" rows="8"></textarea>

<p>Textarea2</p>    
<textarea name="b" id="client" cols="60" rows="8"></textarea>  

<br><br>      
<input type="checkbox" id="Get">
<p>Check this box to copy values</p>  


<script type="text/javascript">
    $("input:checkbox").click(function () {
if (this.checked) {
    $('#client').html($('#ajax').val());
    }
      else {
    $('#client').html($('').val());
     }
   }); 
</script> 

</body>
</html>

Can Anybody Figure it out.. Where I am going wrong ?

Thanks.

-manndaar

+2  A: 

Change your copy/delete code to this:

if (this.checked) {
  $('#client').val($('#ajax').val());
} else {
  $('#client').val('');
}
Gert G
@Gert G : Thanks... Worked Perfect.
MANnDAaR
@manndaar - Good stuff. Thanks. :)
Gert G