When I use javascript to change the innerhtml of a button, the button looses the padding above and below the text, but retains the padding on the sides.
This is the code I use:
document.getElementById("NextBtn").innerHTML="Finish";
How can I resolve this?
With jQuery widgets you can normally target the
.ui-btn-textelement that will be a descendant of the original element. For instance here is the HTML markup for an initialized button widget from the jQuery Mobile framework:Notice the text is inside the
span.ui-btn-textelement. Knowing this we can target that element to update the text:Here is a demo: http://jsfiddle.net/qp3uF/
Update
Since there are several types of buttons you could be talking about, here is how to update the text for each:
Here is a demo: http://jsfiddle.net/qp3uF/2/