I have the following simple bootstrap (3) button, as part of a form:
<button type="button" class="btn btn-success">Click</button>
In the same form, I have jQuery (1.8.2) Ajax action going off upon a blur event of a text box element. According to the response from this action, I disable this button.
At first, it appears that the button is indeed disabled, but as soon as I click ANYWHERE on the page, the button gets re-enabled by itself. I should mention that I have no code that does that, so that's nothing running from my piece of code.
I've tried these ways to disable the button, as described here:
.attr("disabled", "disabled")
.prop("disabled", true)
.addClass("disabled")
.removeClass("btn-success").addClass("btn-disabled")
All of these get the button to be disabled, but none of them stick when I click somewhere, as I've mentioned above. When I'm talking about re-enabled, I mean that according to the method I used to disable it, the opposite action occurs. For example, if I added the attribute "disabled" to the button element, it gets deleted from the element. If I switch between the classes of the button ("btn-success" -> "btn-disabled"), they get switched back. It's like some kind of a virtual Voodoo magic... :( :)
I should also mention that this situation occurs only when the disabling action is running from the embedded code of the website. When I run this specific code in the browser's console, the button stays disabled, like it should.
Further more, I have more buttons like that in the same form and one of them is also disabled, but on HTML level, not by code. There is nothing wrong with this button and it's acting like expected.
What am I missing here??...