If I change the input text of task1
, the text box task2
is changed as expected.
But if I change the text box task2
, text box task3
is not changed.
What is wrong with my code?
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="D:\Website\Jquery/jquery-2.1.4.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#tasks1").change(function () {
alert('testingphase1');
$("#tasks2").replaceWith('<input type="text" id="tasks2" placeholder="t2">');
});
$("#tasks2").change(function () {
alert('testingphase2');
$("#tasks3").replaceWith('<input type="text" id="tasks3" placeholder="t3">');
});
});
</script>
</head>
<body>
<input type="text" id="tasks1" >
<input type="text" id="tasks2" placeholder="taks2">
<input type="text" id="tasks3" placeholder="taks3">
</body>
</html>