jQuery 选择器 <select> in <tr> + css('')

jQuery selector <select> in <tr> + css('')

鉴于下面的 HTML,我正在尝试 select <select><tr id='g2'> 中的 id= "g+anything"

<table>
     <tr id='g1><td>
         <select id="gm">
             <option value="1"></option>
             <option value="2"></option>
         </select>
         </td><td>
         <select id="gg">
             <option value="1"></option>
             <option value="2"></option>
         </select>
     </td>
     <tr id='g2><td>
         <select id="gm">
             <option value="1"></option>
             <option value="2"></option>
         </select>
         </td><td>
         <select id="gg">
             <option value="1"></option>
             <option value="2"></option>
         </select>
     </td>
 <table>
 <button id="button" ></button> 

这是我的 JQuery 代码:

$( "#button" ).click(function() {  
    $('tr#g2 select').css('pointer-events: none');
});

更新:很抱歉我的错误,那只是我网站的一小部分。 我正在尝试调整为可读。

您写的 css 函数有误。请尝试以下操作:

$( "#button" ).click(function() {  
    $('tr#g2 select').css('pointer-events', 'none');
});