i am not very familiar with jquery actually but here is the situation, I have 2 textbox(txt1, txt2), and on load i need to disable txt2, and just enable txt1 for user to input any data at the first place, once the data is input, then the txt2 is enable, but it switch with txt1, which is mean that txt1 is now disabled with the value inside it and txt2 enable for input. All i need is just those two textbox, no checkbox or radio button or else.
below is my code that i have tried but not working.
input 1<input type="text" id="txt1" name="txt1"/> <br>input 2<input type="text" id="txt2" name="txt2" />
<script type="text/javascript">
$(document).ready(function(){
if($('#txt1').val().length != 0){
$('#txt2').attr('disabled',true);
$('#txt1').removeAttr('disabled');
}else
$("#txt2").removeAttr("disabled");
$("#txt1").attr("disabled",true);
</script>
i need help please..