flask wtf 表单如何标识id从而使用js代码

form1的表单类应该也继承了类似js的事件,因此可以给他标识id,同时加上事件

<html>
  <head>
    <title>{{title}}weblib</title>
    <script>
    function changet(x)
    {
    x.style.background = "yellow";
    }
    </script>
  </head>
  <body>
    <form action ="" method="post" name="login">
    {{form1.hidden_tag()}}
    {{form1.openid(size=50, id = "a", onmouseup = "changet(this)")}}<br/>
    {% for error in form1.openid.errors %}
            <span style="color: red;">[{{ error }}]</span>
          {% endfor %}<br>
    <input type = "text" id = "a" onmouseup = "changet(this)"><br/>
    
    </form>
  </body>
</html>

 

posted @ 2017-01-17 22:23  lyn流光  阅读(590)  评论(0)    收藏  举报