Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtomacs1234

macrumors newbie
Original poster
Jul 29, 2009
1
0
Hi there,
I am trying to change the text label of a button on a simple iPhone web app I am developing. Using this command I have been able to change the text:

buttonToChange.innerHTML = buttonToChange.innerHTML.replace(buttonToChange.textContent,text);

However after executing this line of code the clickhandler associated with this button will not fire when the button is clicked.

Is there anyway to simply change the text of a button without affecting its internal properties?

Many Thanks
 
here is a little tid bit of code i use.

Code:
if (whatever) {
        [button setTitle:@"Hide Navigation Bar" forState:UIControlStateNormal];
        [button setTitle:@"Hide Navigation Bar" forState:UIControlStateHighlighted];
    } else {
        [button setTitle:@"Show Navigation Bar" forState:UIControlStateNormal];
        [button setTitle:@"Show Navigation Bar" forState:UIControlStateHighlighted];
    }
 
here is a little tid bit of code i use.
That's for changing a UIButton's title. I believe the OP has an issue when changing the title of an HTML button, since they are developing a web app. As for why the click no longer works, sorry; I have no idea.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.