Link in dialog closes dialog and doesn't do anything else in JqueryMobile
I have a problem with links in dialog page. In fact, these links don't work, they close dialog page and do anything else. I look the demo at http://jquerymobile.com/demos/1.0a2/#docs/pages/docs开发者_运维百科-dialogs.html and links in dialog don't work either.
Have you any idea to correct that?
Thanks.
Link in the demo points back to the page, so it might work... But when I change href with firebug it does the same. Looks like you found a bug in jqm alpha2.
But there's good news. The bug is fixed. See:
http://jquerymobile.com/test/docs/#pages/docs-dialogs.html
http://jquerymobile.com/test/docs is a version of docs generated from the repository (daily or so)
Thanks for this.
But the javascript provided by this link : http://jquerymobile.com/test/js/ but this file is not complete (for example, it doesn't contain data-role="field-contain").
But like said Naugtur, there's good news : I found on the internet the solution : download the version uncompressed of this file : jquery-mobile-1.0a2.js at jquerymobile.com and modify this file :
$.widget( "mobile.dialog", $.mobile.widget, {
$closeBtn = $('<a href="#" data-icon="delete" data-iconpos="notext">Close</a>');
$el.delegate("a, submit", "click submit", function(e){
if( e.type == "click" && ( $(e.target).closest('[data-back]') || $(e.target).closest($closeBtn) ) ){
self.close();
return false;
}
$.mobile.activePage = this.element;
});
Replace the line : if( e.type == "click" && ( $(e.target).closest('[data-back]') || $(e.target).closest($closeBtn) ) ){
by : if( e.type == "click" && ( $(e.target).closest('[data-back]')[0] || this==$closeBtn[0] ) ){
and : $.mobile.activePage = this.element;
by : $.mobile.activePage = self.element;
This works good for me.
精彩评论