Add disabled attribute to input element using Javascript
问题 I have an input box and I want it to be disabled and at the same time hide it to avoid problems when porting my form. So far I have the following code to hide my input: $(".shownextrow").click(function() { $(this).closest("tr").next().show().find('.longboxsmall').hide(); }); This is the input that gets hidden as a result: <input class="longboxsmall" type="text" /> How can I also add the disabled attribute to the input? 回答1: $("input").attr("disabled", true); as of... I don't know any more. It