Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Prevent data-role="button" from double enhancing buttons or inputs #3141

toddparker opened this Issue · 11 comments

7 participants

Todd Parker Kin Blas Maurice Gottlieb Gabriele Rabbiosi Patrick Lismore Anne-Gaelle Colom Ghislain Seguin
Todd Parker

If you add data-role="button" to a button or input type=button/submit/etc. which is automatically enhanced, the script will add the button markup twice: wrapping the input and also injecting the button markup inside the input.

  <input data-role="button" type="submit" value="GO"/>

Even though this is incorrect markup, we should put in a check to see if there is duplication between the role and auto-init and not apply the markup enhancements twice in this scenario to make this fool-proof.

Kin Blas

This should be pretty easy and involve simply checking for the existence of a data object named "button" before executing the code in buttonMarkup().

Maurice Gottlieb

It seems, issue #3005 is related to this one. The duplicate button markup misses the ui-corner-styling for the last button in a controlgroup.

Gabriele Rabbiosi


Sorry, can you create a test page if the problem still exist? I'm not able to recreate the bug here... :(

Todd Parker

Ok, this is so odd, it seems to be working now. Looking at why:

Lots of issues reported on this in the past:

Todd Parker

So any ideas why $("#mytest").button().button('disable'); would disable the button correctly but $("#mytest").button('disable'); doesn't disable the button?

Kin Blas


"disable" is actually a method on the button widget. This is basically a constructor (create) call for the widget:


while this is calling disable() on an existing button:


You can't call the last example unless you've done the first one at some time before.

Todd Parker

@jblas - Thanks, that was what I was thinking, just needed some confirmation.

Garann Means garann referenced this issue from a commit in garann/jquery-mobile
Garann Means garann fix for #3141 - redirect from button() and buttonMarkup() to correct …
…function for element
Ghislain Seguin gseguin closed this in f0849af
Ghislain Seguin gseguin referenced this issue from a commit
Josh Dean Added test for issue #3141 b1c6c4c
Ghislain Seguin gseguin referenced this issue from a commit
Josh Dean Added test for issue #3141 ba9d5a4
Patrick Lismore

Hi everyone, never commented on GitHub before ,

I am having this issue of the button double enhancing.

This is what I have. HTML below (GitHub does not show it)

I also tried with

I keep getting double submit buttons. Its the only thing holding me up at this stage of submitting my app to Apple.

Anne-Gaelle Colom

@lismore could you try to produce a jsbin with your example? template here:
(see details about how to report an issue:

Thank you

Patrick Lismore
Anne-Gaelle Colom

I'm glad you found the problem :-)
and you're very welcome....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.