【问题标题】:Jquery Confirm isn't redirecting to the path after confirmedJquery Confirm 确认后未重定向到路径
【发布时间】:2017-03-14 05:55:11
【问题描述】:

我有一个简单的用例,因为我是 jquery 的新手。在任务被确认为“是”后,Jquery 确认 lib 没有将其重定向到 url。以下是案例:

    <form action'' method='post' ><a href="/cancelforever">
 <span style="color:white;"><span id="changePassBtnText" >
Cancel</span></span></a></form>

<script>
$("#dataConfirm").confirm();
</script>

它会弹出带有消息的窗口,但是当我单击“是”以确认操作时,它不会将我重定向到链接中的 url。就像在“/cancelforever”上一样。

【问题讨论】:

  • 剩下的代码在哪里?
  • 不再编写包含两个 js 文件的库。 github.com/myclabs/jquery.confirm
  • 执行重定向的代码在哪里。如果您使用 jQuery,它通常设置为 var r = confirm("Press a button!"); if (r == true) { txt = "You pressed OK!"; } else { txt = "You pressed Cancel!"; }
  • 这与我在 jquery 库文件中看到的几乎相同的逻辑。你能看看我提供的链接吗?

标签: jquery jquery-plugins


【解决方案1】:

您的 jQuery 代码引用了一个 ID 为 dataConfirm 的元素,但我们在您的 html 中没有看到它。您可能只想将此 id 添加到您的 a 元素中。

<form action'' method='post' >
  <a id="dataConfirm" href="/cancelforever">
    <span style="color:white;">
      <span id="changePassBtnText" >Cancel</span>
    </span>
  </a>
</form>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-30
    • 1970-01-01
    • 2020-03-08
    • 2017-10-19
    • 1970-01-01
    • 2021-05-12
    • 1970-01-01
    • 2011-12-29
    相关资源
    最近更新 更多