小编Sto*_*row的帖子

删除选择器不工作

:odd当我将选择器传递给remove(selector)函数时,为什么选择器不起作用?根据文档,它应该过滤已经选择的项目集,在这种情况下是li.

<ul id='list1'>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
    <li>Four</li>
</ul>
<ul id='list2'>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
    <li>Four</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function() {
    $('#list1').children(':odd').remove(); // works as expected
    $('#list2').children().remove(':odd'); // does not work
});
Run Code Online (Sandbox Code Playgroud)

结果

-One
-Three

-One
-Two
-Three
-Four
Run Code Online (Sandbox Code Playgroud)

jquery

5
推荐指数
1
解决办法
72
查看次数

使用ajax时,Flask flash消息不再有效

当我使用表单操作提交表单数据时,我能够回复消息.

查看表单:

@app.route('/register')
def register():
    return render_template('register.html')
Run Code Online (Sandbox Code Playgroud)

Register.HTML

<form action="{{ url_for('processRegister') }}" method=post>
        <dl>
          <dt>email:
          <dd><input type="text" name="email" id="email">
          <div id="emailBlank" class="error"><font color="red">email cannot be blank</font></div>
          <div id="emailFormat" class="error"><font color="red">invalid email format</font></div>
          <dt>Password:
          <dd><input type="password" name="password" id="password">
          <div id="pwBlank" class="error"><font color="red">password cannot be blank</font></div>
          <dt>Enter password again:
          <dd><input type="password" name="password2" id="password2">
          <div id="pw2Blank" class="error"><font color="red">verify password field cannot be blank</font></div>
          <dd><input type="submit" value="submit" id="submit"><br><br>
        </dl>
        </form>
      <a href="{{ url_for('verifyEmailForm') }}">send another verification email</a>
    {% endblock %}
Run Code Online (Sandbox Code Playgroud)

现在我正在使用ajax我的flash消息不再出现.

$(document).ready(function(){
   (code removed …
Run Code Online (Sandbox Code Playgroud)

python ajax jquery flask

4
推荐指数
1
解决办法
1677
查看次数

标签 统计

jquery ×2

ajax ×1

flask ×1

python ×1