简体   繁体   English

jQuery Mobile中的HTML代码兼容性

[英]HTML code compatibility in jquery mobile

The below html code displays a basic sign up/login form for the user, I want to use it within a page that is built using the jquery mobile library. 下面的html代码为用户显示了基本的注册/登录表单,我想在使用jquery移动库构建的页面中使用它。

At the moment its not working, I'm new to jquery mobile and not sure if I'm breaking a fundamental law and cannot simply drop this into the page and expect it to work. 目前它不起作用,我是jquery mobile的新手,不确定我是否违反了基本定律,不能简单地将其放到页面中并期望它能工作。

I'm thinking I may need to change the code for the buttons to make them work correctly? 我在想可能需要更改按钮的代码以使其正常工作?

I have researched this, but cannot find a 100% answer to the question I'm asking. 我已经对此进行了研究,但是找不到100%的答案。

<script type="text/template" id="login-template">
  <header id="header"></header>
  <div class="login">
    <form class="login-form">
      <h2>Log In</h2>
      <div class="error" style="display:none"></div>
      <input type="text" id="login-username" placeholder="Username" />
      <input type="password" id="login-password" placeholder="Password" />
      <button>Log In</button>
    </form>

    <form class="signup-form">
      <h2>Sign Up</h2>
      <div class="error" style="display:none"></div>
      <input type="text" id="signup-username" placeholder="Username" />
      <input type="password" id="signup-password" placeholder="Create a Password" />
      <button>Sign Up</button>
    </form>
  </div>
</script>

Why is your HTML content within the <script></script> tags? 为什么您的HTML内容位于<script></script>标记中? I'm not familiar with the jQuery Mobile module, however, basic HTML would say this wouldn't work anyway. 我不熟悉jQuery Mobile模块,但是基本的HTML会说这无论如何都行不通。

Try removing said tags to see if it works then. 尝试删除所说的标签,看看是否可行。 I'm not actually sure what you're trying to achieve, so, I can't really contribute a great deal. 我实际上不确定您要达到的目标,因此,我不能做很多事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM