<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<form method="post" action="">
	<table class="formTable">
		<tr>
			<th>ご希望商品(選択2つまで)</th>
			<td>
				<ul>
					<li><input type="checkbox" name="ご希望商品[]" value="ご希望商品01">ご希望商品01</li>
					<li><input type="checkbox" name="ご希望商品[]" value="ご希望商品02">ご希望商品02</li>
					<li><input type="checkbox" name="ご希望商品[]" value="ご希望商品03">ご希望商品03</li>
					<li><input type="checkbox" name="ご希望商品[]" value="ご希望商品04">ご希望商品04</li>
				</ul>
			</td>
		</tr>
	</table>
</form>
	
$("input[type=checkbox]").click(function(){
    var $count = $("input[type=checkbox]:checked").length;
    var $not = $('input[type=checkbox]').not(':checked')

    if($count >= 2) {
        $not.attr("disabled",true);
    }else{
        $not.attr("disabled",false);
    }
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.