我有多个按钮,需要同时激活。当每个按钮被点击从输入它返回什么是类型。问题是,我需要所有的按钮被同时发射关闭。当我有一个单独的按钮发射关闭这些按钮,虽然我得到未定义的,而不是输入。
$(document).on("click", "#devSaveBtn", function () {
if (
$("#primaryBtn").trigger("click") &&
$("#secondaryBtn").trigger("click") &&
$("#thirdBtn").trigger("click")
) {
var getInput = $(this)
.closest("td")
.find("input[name='Object Name']")
.val();
console.log("Input = " + getInput);
var getInput2 = $(this)
.closest("td")
.find("input[name='Project Name']")
.val();
console.log("Input2 = " + getInput2);
var getInput3 = $(this)
.closest("td")
.find("input[name='Description']")
.val();
console.log("Input3 = " + getInput3);
} else {
console.log("This is not working");
}
});
<button type="button" input type="submit" id="devSaveBtn" class="devbutton devinithidden readonlyhidden" title="Reset Changes" style="visibility: visible; background-color: #f4d8b4;"><i class="fa fa-save"></i>
Save</button>
<td class="noncomponentswidth" id="recordObjName">
<p>
<input type="text" id="OBJ_NAME" name="Object Name" placeholder="" required minlength="8">
<button id="primaryBtn">Primary</button>
</p>
<button style="display: none;">Submit</button>
</td>
<td class="noncomponentswidth" id="recordProjectName">
<input type="text" id="DEPLOYER_PROJECT" name="Project Name" placeholder="">
<button id="secondaryBtn">Secondary</button>
</td>
<td class="noncomponentswidth" id="recordDeployerCandidate" placeholder="">
<input type="text" id="DESCRIPTION" name="Description" placeholder="" style="resize: vertical; width: 40em; height: 85px;">
<button id="thirdBtn">Third</button>
</td>
1条答案
按热度按时间b4wnujal1#