当跳转到新的html页面时,先判断checkbox是否选中,选中-->跳转到新页面;未选中--弹出提示消息(请先同意须知)

HTML:

1 <div class="choose">
2    <input class="check checkSty" id="agreeOrNot" type="checkbox"/>
3    <div class="notic">我已阅读并同意须知内容</div>
4  </div>
5  <!-- button -->
6  <a href="number.html">
7    <div class="sub btn" onclick = "return enter();">前往排队取号</div>
8  </a>

js:

<script>
  var enter =function(){
    var checkSty = $(".checkSty").is(":checked");
    //判断checkbox是否被选中
    if (checkSty==false){
        //r如果没有被选中,则显示弹窗
        layer.msg('请先同意阅读须知!');
        return false;
        }
        else {
            return true;
        }
  }
</script>

注:需要引入layer.css和layer.js两个文件

相关文章:

  • 2022-12-23
  • 2021-09-12
  • 2021-07-02
  • 2022-12-23
  • 2021-07-25
  • 2021-12-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
相关资源
相似解决方案