Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a submit input un-clickable

I have the following input:

<input type="submit" name="next" value="Next">

How would I make this item un-clickable via jQuery? (i.e., it may only be clicked after certain validation criteria are met) ?

Here is a follow-up to this question: Make a submit clickable after validations are met

like image 317
David542 Avatar asked May 24 '12 03:05

David542


People also ask

How do you make an input not clickable?

Try disabled="disabled" . This will disable textbox / textarea, so it won't be selected. Also, the value won't be submitted on form submission. In HTML5, only disabled attribute will also work.

How do you make a submit button Unclickable?

Enable / Disable submit button 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.

How do I change the input submit button text?

The attribute that changes the name shown on the Submit Button is the Value attribute. You can change the text that appears on the Submit Button by setting the Value attribute to the desired name you want.

How do I disable labels?

To disable a label, disable the form control it is associated with. That won't change the appearance of the label though, for that you have to change the CSS that applies to it. That is best done by adding (or removing) a class from the element (and having a pre-existing CSS ruleset that matches that class).


1 Answers

2 Demos Demo 1 click here: or Demo 2 click here:

so all you will need is to check if the validation is done correctly of not.

i.e. if (notValid) chuck in the code below and that will disable the button. or better yet start with the disabled next button.

To enable you can set the property as false, I am sure you get a good idea, else provide more code; I am happy to help you further. B-)

Hope this helps!

$("#submit").prop('disabled', true);​

OR

$("input[type='submit']").prop('disabled', true);​
like image 155
Tats_innit Avatar answered Nov 09 '22 21:11

Tats_innit