if(function()=== false){执行此操作 [英] if (function() === false){ do this}

查看:68
本文介绍了if(function()=== false){执行此操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决此问题,我对javascript还是比较陌生,所以:

i'm trying to solve this issue, i'm relatively new to javascript, so:

函数termos()给出的是正确还是错误的结果;

function termos() gives a true or false result;

解决这个问题的方法可能很简单,但却无法解决.是否有可能做到这一点?我写这段代码只是为了说明我的疑问

probably the solution to this is simple, but can't get to it. Is it possible to do this? i wrote this code just to exemplify my doubt

function termos() {
  if($('.terms').is(':checked')) {
    return true;
  } else {
    return false;
  }
}

我可以使用

} else if(termos() === false) {
  alert('please agree with terms');
  return false;
}

这不起作用

推荐答案

这解决了我的问题.感谢谁尝试提供帮助.

This solved my problem. Thanks to who tried to help.

function termos(){
        if ($('.checky3').is(':checked')){
            return 1;
        }
    }

if (termos() !== 1){
        $('.checky3').css('border','solid 1px red');
        return false;
}

这篇关于if(function()=== false){执行此操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆