I am trying to get the parent div of the 'button1' and enable all the inputs in that div (I currently have them disabled'
<div id="wrapper">
<div id="gameInfo">
<asp:TextBox ID="gameTitle"/>
<asp:TextBox ID="gameType" />
<asp:TextBox ID="gameprice"/>
<input type="button" id="button1" value="enable" onClick="myFunc()"/>
</div>
javascript:
function myFunc() {
setTimeout(function () {
var inputs = document.getElementById("button1").parentNode.querySelectorAll('input[type="text"]');
[].forEach.call(inputs, function (input) {
input.disabled = false;
});
});
}
I am trying to get the parent node of button1 and then I'm not really sure of the correct way of doing it but I want all the inputs in that parent div of the button to enable but only of the parent div of the button I clicked. Any suggestions?
No comments:
Post a Comment