【问题标题】:JQuery Mobile data-rel="back" not working in dialogsJQuery Mobile data-rel="back" 在对话框中不起作用
【发布时间】:2012-05-21 13:52:02
【问题描述】:

我试图在我的 express.js 项目中使用 jquery 移动对话框来显示错误。我能够成功显示带有错误的对话框,但我的问题是当我单击对话框关闭按钮时,浏览器会返回主页然后返回对话框。这是我的代码:

div#home(data-role='page',data-theme="f",data-url='/')
    header(data-role='header')
        h1= title
    div(data-role='content',role='main')
      -if(typeof error !== "undefined")
         script(type='text/javascript')
          $(function() {
           $('#dialogbody').html("<p>#{error}</p>");
           $.mobile.changePage('#dialog', 'pop', true, true);
          });
      -if(typeof info !== "unddefined")
         script(type='text/javascript') 
          $.mobile.changePage('#dialog', 'pop', true, true);
      form(name='home',action='/', method='POST')   
       div(data-role='fieldcontain')
        fieldset(data-role='controlgroup')
         label.label(for='email') email
         input.input.required.email(id='email',type='text',value='',placeholder='name@email.com',name='email')
         label.label(for='password') password
         input.input.required(id='password',type='password',value='',placeholder='Enter your password',name='password')
        fieldset.ui-grid-a
          div.button.ui-block-a
             input.button(type='submit',value='Sign In',data-transition='fade',data-theme='a',style='width: 100%;')
          div.ui-block-b   
             input(type='submit',value='Sign Up',data-transition='fade',data-theme='b',onclick="home.action='/signup'; return true;")
        div
             a( data-transition='fade', data-theme='a',href=paypalURL) 
div(id='dialog',data-role='dialog',data-overlay-theme='a',data-transition='pop')
        div(data-role='content')
            div (id='dialogbody') 
            <a href="#" data-role="button" data-rel="back" data-theme="a">Close</a>

是我遗漏了什么还是 JQuery mobile 中的错误?

谢谢

【问题讨论】:

  • 这行代码中有一个错字 - if(typeof info !== "unddefined")。我认为您的意思是“未定义”。但可能与您的问题无关。跨度>
  • 是的,你是对的。但我认为这不相关。

标签: jquery node.js jquery-mobile express pug


【解决方案1】:

输出代码是否正确?你能过去吗?

您将 a 元素放在 html 语法中而不是 Jade 中,这可能是问题所在。

【讨论】:

    猜你喜欢
    • 2013-04-09
    • 1970-01-01
    • 2013-03-26
    • 1970-01-01
    • 2012-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多