Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4597778
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:18:21+00:00 2026-05-21T23:18:21+00:00

Wondering if you can help me out. I seem to have a problem changing

  • 0

Wondering if you can help me out. I seem to have a problem changing the text of my jQuery Mobile buttons with jQuery.

$("#myButton .ui-btn-text").text("New text"); 

Code above which was recommended for a related question doesn’t seem to work.

Neither does:

$("#myButton").attr(value,"New Test");

The code for my button is as followed:

<input type="button" name="answer" id="myButton" data-theme="b" data-answer="4" value="next"></button>

I’ll appreciate any feedback guys. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T23:18:22+00:00Added an answer on May 21, 2026 at 11:18 pm

    Update 2
    I was working on a fiddle for another question and I noticed that the markup with jQuery Mobile 1.0b2 is a little different:

    <div data-theme="b" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-down-b ui-btn-hover-b" aria-disabled="false">
        <span class="ui-btn-inner ui-btn-corner-all">
            <span class="ui-btn-text">Show Submit Button</span>
        </span>
    
        <input type="button" name="answer" id="myButton" data-theme="b" data-answer="4" value="next" class="ui-btn-hidden" aria-disabled="false">
    </div>
    

    With this markup, you’d need to do the following to change the text for the button:

    $('#myButton').prev('span').find('span.ui-btn-text').text("Next Text"); 
    

    Update
    Credit where credit is due – As it turns out, @naugtur’s answer to this question, which made exactly the same point as my edit, was posted before I got around to correcting my original answer.


    I’m not very familiar with jQuery Mobile and the fact that you were using an <input> for the button didn’t register when I initially answered. Here’s my updated answer with a working example showing how you might do it.

    In the case of an <input type="button" />, jQuery Mobile seems to hide the <input> element and creates a new <a> element that is styled to look like the button. This is why when you try to get and set the text by using the id of the <input> as the selector, it doesn’t work since that <span> doesn’t have the text that you see on screen. The generated markup looks something like this

    <!-- This 'a' button is added dynamically by jQuery Mobile, for the input element that follows it -->
    <a role="button" href="#" data-theme="c" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c">
        <span class="ui-btn-inner ui-btn-corner-all">
            <span class="ui-btn-text">My Value</span>
        </span>
    </a>
    
    <input type="button" data-role="button" value="My Value" id="myButton" name="answer" class="ui-btn-hidden ui-btn ui-btn-up-c ui-btn-corner-all ui-shadow" tabindex="-1" data-theme="c">
        <span class="ui-btn-inner ui-btn-corner-all">
            <span class="ui-btn-text"></span>
        </span>
    </input>
    

    I haven’t tried out enough examples to be completely confident, but this should work

    $("#myButton").prev('a').find('span.ui-btn-text').text("New Text")
    

    Here’s a working example showing how to change text for both types of buttons (<a> and <input type="button">).

    I wouldn’t recommend using this over <a> buttons if you can help it though since there isn’t an id and my approach, at least, relies on the fact that the <a> corresponding to the <input type="button" /> appears just before the <input> element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering if someone can help me figure out the best approach to
Wondering if anyone can help me with this annoying but trivial (in terms of
I was wondering if anyone can help me get started with creating a room
So hopefully with some CSLA skills out there can help me see a better
Does anyone know if there is a help authoring tool out there that can
I'm learning Javascript (mainly using JQuery) and was wondering if somebody could help me.
I was wondering how can I set a timeout on a socket_read call? The
I'm wondering how can I submit a form via Ajax (using prototype framework) and
I'm wondering how you can implement a program similar to tail -f in C/C++,
I was wondering how i can force a user who has requested a page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.