Change the value of synced textarea with keyup event in JavaScript

Viewed 345

I would like to change ik into b each time but it changes only once. I tried lot of methods to change it dynamically but I couldn't. Can anyone help?

$(document).ready(function() {
    $("#ta_1").keyup(function(event) {          
        var text1 = $("#ta_1").val();      
        var text2 = text1.replace("ik", "b");      
        $("#ta_2").val(text2);
   });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="ta_1"   rows="5" cols="28" ></textarea>
<textarea id="ta_2"   rows="5" cols="28"></textarea>

2 Answers
Related