Reputation: 1447
This seems like it should be quite easy, but I'm not sure why it isn't working. I have a button I create in Razor like so:
@Html.ActionLink("Next", "Add-Remove", "Catalogue-Item-Authors", new { id = Model.CatalogueItemID }, new { @class = "btn btn-default", @id = "next-button", @disabled="disabled" })
I want it to be disabled as first, but when my submit button is clicked, it should be enabled. I have a form and in the OnSuccess
parameter of the form I call EnableNext()
. Here is the function:
function EnableNext() {
document.getElementByID('next-button').disabled = false;
}
It gets called at the right time, I verified that by placing alert("test")
in the funciton, but the button is never enabled. Can anyone see why my button wouldn't be getting enabled?? Thanks.
Upvotes: 0
Views: 315
Reputation: 7740
I'm not sure why setting disabled = false
is not working, perhaps because you are using an anchor
tag and not a button
tag, but what does work is doing:
document.getElementById('next-button').removeAttribute('disabled')
Also, note that the d
in getElementById
should not be capitalized.
Upvotes: 1