Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2つのリンクがあります。1つのリンクでテキストが赤になり、もう1つのリンクでテキストが青になります。1つのリンクをクリックした後、両方のリンクを無効にします。
両方にイベント ハンドラーをアタッチし、起動された場合は、両方のイベント ハンドラーを削除します。どちらかをクリックすると、両方が無効になります。
$('#red, #blue').on('click', function() { $('#red, #blue').off('click'); //$('#red, #blue').prop('disabled', true); });
「無効」とは何を意味するのか、またはダブルクリックがそれと関係があるのか わかりませんが、どちらの方法でも概念は同じですか?