468,104 Members | 1,320 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,104 developers. It's quick & easy.

Disabling button

Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(

S

Jan 30 '07 #1
3 3276
1)Find your button
ex:var myu_btn = document.getElementById("submit_btn");
2)disable it
myu_btn.disabled = true;

A button being disabled or inabled is just one of it's attributes.
Alternately you can search your page for all input tag elements where
the type attribute is 'button' or 'submit' and disable them. For more
info just google input tag attributes.
On Jan 30, 6:26 am, "Sonnich" <sonnich.jen...@elektrobit.comwrote:
Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(

S
Jan 30 '07 #2


On Jan 30, 5:09 pm, Curtis.Dani...@gmail.com wrote:
1)Find your button
ex:var myu_btn = document.getElementById("submit_btn");
2)disable it
myu_btn.disabled = true;

A button being disabled or inabled is just one of it's attributes.
Alternately you can search your page for all input tag elements where
the type attribute is 'button' or 'submit' and disable them. For more
info just google input tag attributes.
On Jan 30, 6:26 am, "Sonnich" <sonnich.jen...@elektrobit.comwrote:
Thanks

I found something like:

function disableSubmits(form)
{
for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].type.toLowerCase() == 'submit')
form.elements[i].disabled = true;
}

and...

echo "<form method=post name='myform' action='".$sTemp."'
ONSUBMIT=\"if (this.submitted) return false; else
{ this.submitted = true; disableSubmits(this); return true; }\"
>";
but my problem is that I have 2 buttons for submit (2 ways), and when
adding this only the first one works - it disable the buttons, but
also the functionality of the second one.

can anyone help

BR
S

Jan 30 '07 #3
Sonnich wrote on 30 jan 2007 in comp.lang.javascript:
Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(
<button
onclick='alert("No more");this.disabled=true'>
Click me once
</button>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Papajo | last post: by
2 posts views Thread by Jeelz | last post: by
4 posts views Thread by Dan =o\) | last post: by
7 posts views Thread by Vignesh | last post: by
2 posts views Thread by dougawells | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.