チェックボックスをクリックした後、テキストフィールドにデータをロードするにはどうすればよいですか?その後、そのテキストボックスを無効にする必要がありますが、チェックを外すと、そのデータを削除し、テキストボックスにデータを手動で入力できるようにする必要があります。私はこのコードを試しました.私はjquery/ajaxが初めてで、この問題を解決する方法がわかりません.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$('#chk').click(function(){
if($(this).is(":checked"))
$("#txtaddress").removeAttr("disabled");
else
$("#txtaddress").attr("disabled" , "disabled");
// here, i don't know how do i assign $row['address'] to txtaddress by
// using php mysql
});
});
</script>
<!-this is my html code-->
<form>
<input type="checkbox" id="chk" name="chk">Same as home address?
<input id="txtaddress" name="txtaddress" disabled type="text">
</form>