How do you change the text value of a button in jQuery? Currently, my button has ‘Add’ as its text value, and upon being clicked I want it to change to ‘Save’. I have tried this method below, but so far without success:
$("#btnAddProfile").attr('value', 'Save');
Depends on what type of button you are using
Your button could also be a link. You’ll need to post some HTML for a more specific answer.
EDIT : These will work assuming you’ve wrapped it in a
.click()call, of courseEDIT 2 : Newer jQuery versions (from > 1.6) use
.proprather than.attrEDIT 3 : If you’re using jQuery UI, you need to use DaveUK’s method (below) of adjusting the text property