jQuery - *:not() not excluding elements
问题 My goal is to disable right-click everywhere except <kbd> and <textarea> tags. I am using *:not(kbd,textarea) to exclude disabling right-click - .on('contextmenu', function(e){ e.preventDefault(); }); . It is supposed that I can right click on <kbd> and <textarea> tags but I cannot. It is werid. $(document).ready(function(){ $('*:not(kbd,textarea)').on('contextmenu', function(e){ e.preventDefault(); }); }); div { width: 170px; height: 170px; background-color: green; } <script src="https:/