Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable input element whose type is submit?

Tags:

html

input

I know the following works:

<input type="text" disabled="disabled" />
<button disabled="disabled"> 

But how would you disable this?

<input type="submit" ....>

Any idea? Do I have to use javascript?

Thanks.


Okay. It might have been my Firefox problem. I swear I did use the same synatx. Thanks, and sorry for such a silly question?

like image 258
CppLearner Avatar asked Jan 17 '12 10:01

CppLearner


People also ask

How do I make input type submit disabled?

1.1 To disable a submit button, you just need to add a disabled attribute to the submit button. $("#btnSubmit"). attr("disabled", true); 1.2 To enable a disabled button, set the disabled attribute to false, or remove the disabled attribute.

Which attribute is used to disable the input elements?

The disabled attribute is a boolean attribute. When present, it specifies that the element should be disabled. A disabled element is unusable.

How do I enable and disable input fields?

We can easily disable input box(textbox,textarea) using disable attribute to “disabled”. $('elementname'). attr('disabled','disabled'); To enable disabled element we need to remove “disabled” attribute from this element.

How do you disable form submit button until all input fields are filled?

Just click f12 in your browser, find the submit button in the html, and then remove the disabled ! It will submit the form even if the inputs are empty.


1 Answers

You can use disabled="disabled" on input's that are of type submit:

<input type="submit" disabled="disabled" />
like image 59
Curtis Avatar answered Sep 18 '22 17:09

Curtis