Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Dashboard-change button label

Ok, I feel stupid for having to ask this, but how on earth can you change the label of a button in a dashboard widget? I have tried setting the label, innerText and textElement properties, as well as getting the innerHTML property and changing the proper (I think) portion of that, all with no luck. Either nothing seems to happen, or the button is replaced with static text. In the case of replacing the innerHTML property, it actually retained the button appearance, but was no longer clickable. What am I missing here? The next challenge after that gets worked out is to get it hold the text for two seconds and then change back, but I haven't started looking into the documentation for that yet 🙂 Thanks.

2.4 GHz 20" iMac C2D, Mac OS X (10.5.4), 3 GB RAM

Posted on Jun 17, 2009 6:54 PM

Reply
5 replies

Jun 17, 2009 9:55 PM in response to K T

Probably, but I need a button, and trying to do some kind of overlay seems overly complicated. I could do a separate label, which would work easily enough, but that just feels kludgy, so I'd rather not. I would think it should be fairly easy just to change the button text. At least, it has been in every other type of application I have made. I have to think I'm just missing something here. Maybe I'll figure it out tomorrow - for now, to bed 🙂

Jun 18, 2009 1:26 PM in response to Israel Brewster

Ah-ha! Found it! It is the innerText property, but it needs to be set not on the button returned by getElementById, but rather on the textElement of the object of the button! I.e., rather than the following code:
var button=document.getElementByID("buttonName");
button.innerText="Whatever";

I need this:
var button=document.getElementByID("buttonName");
button.object.textElement.innerText="Whatever";

The first one changes the button to just plain text, the second one actually changes the text on the button. Course, that doesn't explain why it was so difficult to track that down... I can't imagine that I'm the first person who wanted to change button text! 🙂

Dashboard-change button label

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.