Hide X/close button option on Dialogs #3886

bradorego opened this Issue Mar 23, 2012 · 3 comments


None yet

6 participants


In a move toward a configurable "modal" native jqm dialog, there should be some way to hide the "X" button that appears on dialogs. I've hacked something together in my app to delete the button and to catch back-button events on specific pages, but I feel like this could be configurable (e.g. $.mobile.dialog.options.addBackBtn = false [default true]).

If we wanted to go a step further and make "modal" dialogs, we could do the back-button catch thing as well, and have that configurable as well (e.g. $.mobile.dialog.options.modal = true [default false]).

I'd love to get involved with jQM development, so if we think this is something that would be widely used, if someone could point me in the direction of working on jQM, I'd be more than happy to supply/refine my hack and start fixing other bugs :D

  • Brad

I agree that this would be a good option to add for 1.2 and I think that option name seems in line with what we're doing on pages. We'd appreciate the help, so please feel free to submit a PR with this new option and we'll give it a look for 1.2.

As far as true modals go, we have popups slated for 1.2 what do what I think you're asking for. Check out the popup branch to preview where we are with that feature.

If you have time to help out, starting by submitting PRs for bugs would be very helpful. If you can keep fixes as small as possible add unit tests, that is appreciated. If you have q's, the team is on #jquermobile-dev on freenode IRC.


I implemented ability to remove Close button for each dialog, but I didn't implement ability to prevent the click on button Back or Forward, because I think we should do it after the issue #3654 will solved. Also, I think we should have ability for understanding how the history traversing event was invoked, eg. by clicking on browser button Back or Forward (or Back button on mobile devices), programatically by window.history.back() or by data-rel="back".

As far the fix 07d73e8, for now we can remove Close button for each dialogs using the example of code below:

$(document).ready(function() {
    $.mobile.dialog.prototype.options.hideCloseBtn = true;

We are planning on adding an option data-closebtn=”left/right/none” for dialogs in 1.3.

#2257 has been closed as duplicate. It was a request for an option to set the position (left/right) for the close button.

@gseguin gseguin was assigned Oct 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment