Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
181
rated 0 times [  184] [ 3]  / answers: 1 / hits: 106525  / 12 Years ago, wed, june 20, 2012, 12:00:00

I have two different buttons on my page. I want them both to be enabled when the page loads, but when a user clicks one I would like to disable the other button. But if they click the other button, I would like that button to disabled as well while enabling the other disabled button. I have been able to disable the button onclick, but I'm having trouble getting the other button to re-enable . Here are the two buttons that I have on the page. They are not in a form, just on the page.



<button onclick=down7913.disabled=false type=submit class=positive name=up7913><img src=check.png alt=/></button>

<button onclick=this.disabled=true type=submit class=negative name=down7913><img src=cross.png alt=/></button>

More From » html

 Answers
12

Check this code, it's in your flavour and working:



Code Snippet -





<button
onclick=this.disabled=true;document.getElementById('down7913').disabled=false;
type=submit
class=positive
name=up7913
id=up7913
>
First
</button>

<button
onclick=this.disabled=true;document.getElementById('up7913').disabled=false;
type=submit
class=negative
name=down7913
id=down7913
>
Second
</button>




[#84796] Monday, June 18, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maryann

Total Points: 600
Total Questions: 104
Total Answers: 97

Location: Sint Maarten
Member since Tue, Mar 29, 2022
2 Years ago
maryann questions
Fri, Oct 15, 21, 00:00, 3 Years ago
Thu, Aug 13, 20, 00:00, 4 Years ago
Wed, Jul 17, 19, 00:00, 5 Years ago
Mon, Dec 17, 18, 00:00, 6 Years ago
;