<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
	<title></title>
</head>
<body>
	<div class="testbox">
		<div class="box">
			<div class="del">del</div>
		</div>	
		<div class="box">
			<div class="del">del</div>
		</div>	
	</div>
	<div class="reload">reload</div>
</body>
<style>
	.box{
		width: 100px;
		height: 100px;
		background: blue;
	}
</style>
<script>
// 通常の削除処理
$('.del').on('click', function(){
   console.log('on');
   $(this).parent().remove();
 });

$('.reload').on('click', function(){
   console.log('reload');
	// $('.testbox').on().load(location.href + ' .testbox > *');
	$(".testbox").load(location.href + ' .testbox > *', function(){
		$("body").trigger("fileLoaded");
	});
 });	
// DOMの更新があったとき(ファイルがロードされた場合の処理を別途追加
$("body").on("fileLoaded", function() {
	$('.del').on('click', function(){
	   console.log('on');
	   $(this).parent().remove();
	 });	
});





// add_260223

// 1枚フラグ
$('#topSlide').on('click', function(){
	// on/off切り替え
	$(".box").toggleClass("chkd");
	// onになったら
	if($(".box").hasClass("chkd")) {// チェックボックス チェック
	   console.log('slide');
		$('.box:first').css("border","solid 2px #9F9");
	} else {// チェックボックス ノーチェック
		$(".box input").prop("checked", false);
		$('.box:first').css("border","none");
	}
 });

$('.reload').on('click', function(){
   console.log('reload');
	$(".testbox").load(location.href + ' .testbox > *', function(){
		$("body").trigger("fileLoaded");
	});
 });


// DOMの更新があったとき(ファイルがロードされた場合の処理を別途追加
$("body").on("fileLoaded", function() {
	$('.del').on('click', function(){
	   console.log('on');
	   $(this).parent().remove();
	 });
	$('#topSlide').on('click', function(){
		// on/off切り替え
		$(".box").toggleClass("chkd");
		// onになったら
		if($(".box").hasClass("chkd")) {// チェックボックス チェック
		   console.log('slide');
			$(".box input").prop("checked", true);
			$('.box:first').css("border","solid 2px #9F9");
		} else {// チェックボックス ノーチェック
			$(".box input").prop("checked", false);
			$('.box:first').css("border","none");
		}
	 });
});

	
</script>
</html>