我目前有一个小页面,上面有 9 个按钮。四个被分配到一个班级,五个被分配到另一个班级。在页面的整个生命周期中,5 的值可能会更改为两个值之一。我想在 jQuery 语句中创建一个 if 语句来检查属于同一类的五个按钮的值。当它们的值都等于一件事时,就会触发一个函数。
我有这个功能,我只是在创建条件语句时遇到了麻烦。
编辑:我真的不能给出所有的代码。它会占据整个页面。这是我要监视的按钮:
<input id="link1" type="button" value="[+] Expand" onclick="toggleVisibility('table1', 'link1')" class="expander" />
<input id="link2" type="button" value="[+] Expand" onclick="toggleVisibility('table2', 'link2')" class="expander" />
<input id="link3" type="button" value="[+] Expand" onclick="toggleVisibility('table3', 'link3')" class="expander" />
<input id="link4" type="button" value="[+] Expand" onclick="toggleVisibility('table4', 'link4')" class="expander" />
<input id="link5" type="button" value="[+] Expand" onclick="toggleVisibility('table5', 'link5')" class="expander" />
这是当这五个按钮的所有值都是“[+] Expand”时我想要触发的 jQuery 函数
function () { $("#bottom-wrap").addClass("absolute-bottom") }