/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Help changing text in a button

Hi all,

Ive got a javascript that disable a button while the serverside code is running, this is to prevent multiple clicks (it’s because is a credit card transaction) now I need to change the text of the button from “submit” to “wait” while is disabled.
How do i do that? here’s my code:

<script language=”javascript” type=”text/javascript”>
<!–

function DisableButton() {
document.forms[0].submit();
window.setTimeout(“disableButton(‘” + window.event.srcElement.id + “‘)”, 0);
}

function disableButton(buttonID) {
document.getElementById(buttonID).disabled=true;
}

//–>

</script>

Thanks in advance,

Maurizio

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangJul 24.2008 — For an input:

[I]document.getElementById(buttonID).value='wait';[/I]

For a button:

[I]document.getElementById(buttonID).firstChild.data='wait';[/I]
Copy linkTweet thisAlerts:
@mauriziolauthorJul 24.2008 — Unfortunately doesnt work, maybe I dont know exactely where place the code or maybe because the button is an asp:button

Any other suggestion?

Thanks

Maurizio
Copy linkTweet thisAlerts:
@FangJul 24.2008 — Show the generated code.
Copy linkTweet thisAlerts:
@mauriziolauthorJul 24.2008 — Hi,

Sorry it works I was mistyping your code!

Thanks for your help and for your time!
×

Success!

Help @mauriziol spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...