简体   繁体   English

按钮提醒

[英]Alertify in Button

How to show an alert when an input is empty? 输入为空时如何显示警报?

Here's the code.. 这是代码。

function rfc_vacio(){
  if ($('#RFC_v').val() == "") {
        alert("Empty");
        $('#RFC_v').focus();
        return false;
      }else{
        return true;
      }
}

i want to changue to alerfity,im new on bootstrap 我想改变容忍度,我是新手

function rfc_vacio(){
  if ($('#RFC_v').val() == "") {
     alertify.alert("Input is empty", function(){
         alertify.message('OK');
     });
        $('#RFC_v').focus();
        return false;
      }else{
        return true;
      }
}

alert converted to alertify, make sure you read examples on your new javascript framework http://alertifyjs.com/ alert转换为alertify,请确保您已阅读有关新javascript框架http://alertifyjs.com/的示例

Get jQuery to trigger on the input changing 获取jQuery以在输入更改时触发

$('#my-input').change(function() {
    if ($('#RFC_v').val() == "") {
        alertify.alert("Empty", function(){
         alertify.message('Whatever');
     });
     $('#RFC_v').focus();
  }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM