javascript - Enable button when something was changed in the screen -
javascript - Enable button when something was changed in the screen -
i've created mvc5 application table , have create page next code include text boxes ,check boxes , drop downwards list, code working fine need alter save button disabled until user change in screen ,for illustration type value in text box or alter value , in drop downwards list or check/uncheck checkbox,how should ?
@using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>ad</h4> <hr /> @html.validationsummary(true) <div class="form-group"> @html.labelfor(model => model.server, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.server) @html.validationmessagefor(model => model.server) </div> </div> <div class="form-group"> @html.labelfor(model => model.checkbox, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.checkbox) @html.validationmessagefor(model => model.checkbox) </div> </div> <div class="form-group"> @html.labelfor(model => model.user, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.user) @html.validationmessagefor(model => model.user) </div> </div> <div class="form-group"> @html.labelfor(model => model.password, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.password) @html.validationmessagefor(model => model.password) </div> </div> <div class="form-group"> @html.labelfor(model => model.selectedsystemtype, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.dropdownlistfor(model => model.selectedsystemtype, model.systemtype) @html.validationmessagefor(model => model.selectedsystemtype) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="create" class="btn btn-default" /> </div> </div> </div> }
for need client-side code observe alter in value.
here jquery code that.
$('input').change(function () { // enable button }
this enough, check value every input field , trigger when there alter in field. add together more such events want.
checkbox type of input element, trigger same thing. dropbox (select in html) work this
$('select').change(function () { // enable button }
this check select statement change.
javascript jquery asp.net asp.net-mvc asp.net-mvc-4
Comments
Post a Comment