如果我点击按钮,我想更改按钮的边框,如果再次点击按钮,则更改回来。 (只有当我点击它时)因为我在同一个班级有16个按钮。所以我希望能够同时或全部点击它们中的五个等...
HTML
<button onclick="TogglePkgGroups('M16.1')" class="pool" id="M16.1">M16.1</button>
<button onclick="TogglePkgGroups('M16.2')" class="pool" id="M16.2">M16.2</button>
<button onclick="TogglePkgGroups('M17')" class="pool" id="M17">M17</button>
<button onclick="TogglePkgGroups('MR17')" class="pool" id="MR17">MR17</button>
<button onclick="TogglePkgGroups('MSS16c')" class="pool" id="MSS16c">MSS16c</button>
<button onclick="TogglePkgGroups('MSS17')" class="pool" id="MSS17">MSS17</button>
<button onclick="TogglePkgGroups('MSS17c')" class="pool" id="MSS17c">MSS17c</button>
<button onclick="TogglePkgGroups('T15.0')" class="pool" id="T15.0">T15.0</button>
<button onclick="TogglePkgGroups('T15.0c')" class="pool" id="T15.0c">T15.0c</button>
<button onclick="TogglePkgGroups('T15.5')" class="pool" id="T15.5">T15.5</button>
<button onclick="TogglePkgGroups('T15.5c')" class="pool" id="T15.5c">T15.5c</button>
<button onclick="TogglePkgGroups('T15.8')" class="pool" id="T15.8">T15.8</button>
<button onclick="TogglePkgGroups('T15.8c')" class="pool" id="T15.8c">T15.8c</button>
<button onclick="TogglePkgGroups('T16.2')" class="pool" id="T16.2">T16.2</button>
<button onclick="TogglePkgGroups('T16.2c')" class="pool" id="T16.2c">T16.2c</button>
<button onclick="TogglePkgGroups('T16.5')" class="pool" id="T16.5">T16.5</button>
答案 0 :(得分:0)
<button class="pool" id="M16.1">M16.1</button>
<button class="pool" id="M16.2">M16.2</button>
<button class="pool" id="M17">M17</button>
<button class="pool" id="MR17">MR17</button>
<button class="pool" id="MSS16c">MSS16c</button>
<button class="pool" id="MSS17">MSS17</button>
<button class="pool" id="MSS17c">MSS17c</button>
<button class="pool" id="T15.0">T15.0</button>
<button class="pool" id="T15.0c">T15.0c</button>
<button class="pool" id="T15.5">T15.5</button>
<button class="pool" id="T15.5c">T15.5c</button>
<button class="pool" id="T15.8">T15.8</button>
<button class="pool" id="T15.8c">T15.8c</button>
<button class="pool" id="T16.2">T16.2</button>
<button class="pool" id="T16.2c">T16.2c</button>
<button class="pool" id="T16.5">T16.5</button>
脚本:
$(function(){
$(this).click(function(){
$($this).toogleClass('select-pool');
});
});
和select-pool
的css:
.select-pool{
border-color: red/*chabge it according your color*/
}