I have code setup like so:
<form>
<button id="button1">button1</button>
<button id="button2">button2</button>
<input type="submit" value="submit">
</form>
Initially how would I make my submit button disabled until either button1 or button2 is clicked?
The most important question is how to enable the disabled button while at the same time disabling the alternate button. This is so that the user can only submit one of the button's values and not both buttons.
I'm aware that I would use $('#button').attr("disabled", "disabled")
to add the disabled attribute and also set the button by using $('#button').attr("disabled", true)
or $('#button').attr("disabled", false)
. I'm also aware that .removeAttr
method removes attributes however im unsure how to piece this all together. Any help would be much appreciated.