<legend id='Hmm6v'><style id='Hmm6v'><dir id='Hmm6v'><q id='Hmm6v'></q></dir></style></legend>
  • <i id='Hmm6v'><tr id='Hmm6v'><dt id='Hmm6v'><q id='Hmm6v'><span id='Hmm6v'><b id='Hmm6v'><form id='Hmm6v'><ins id='Hmm6v'></ins><ul id='Hmm6v'></ul><sub id='Hmm6v'></sub></form><legend id='Hmm6v'></legend><bdo id='Hmm6v'><pre id='Hmm6v'><center id='Hmm6v'></center></pre></bdo></b><th id='Hmm6v'></th></span></q></dt></tr></i><div id='Hmm6v'><tfoot id='Hmm6v'></tfoot><dl id='Hmm6v'><fieldset id='Hmm6v'></fieldset></dl></div>
    1. <small id='Hmm6v'></small><noframes id='Hmm6v'>

          <bdo id='Hmm6v'></bdo><ul id='Hmm6v'></ul>
        <tfoot id='Hmm6v'></tfoot>
      1. 多个输入框 - alertifyjs/Jquery

        时间:2023-09-04

      2. <i id='TDrLk'><tr id='TDrLk'><dt id='TDrLk'><q id='TDrLk'><span id='TDrLk'><b id='TDrLk'><form id='TDrLk'><ins id='TDrLk'></ins><ul id='TDrLk'></ul><sub id='TDrLk'></sub></form><legend id='TDrLk'></legend><bdo id='TDrLk'><pre id='TDrLk'><center id='TDrLk'></center></pre></bdo></b><th id='TDrLk'></th></span></q></dt></tr></i><div id='TDrLk'><tfoot id='TDrLk'></tfoot><dl id='TDrLk'><fieldset id='TDrLk'></fieldset></dl></div>

        <legend id='TDrLk'><style id='TDrLk'><dir id='TDrLk'><q id='TDrLk'></q></dir></style></legend>

        <small id='TDrLk'></small><noframes id='TDrLk'>

            <bdo id='TDrLk'></bdo><ul id='TDrLk'></ul>

                <tbody id='TDrLk'></tbody>
                • <tfoot id='TDrLk'></tfoot>
                  本文介绍了多个输入框 - alertifyjs/Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用具有多个输入框的 alertifyjs 创建一个提示对话框.我设法创建了显示多个框的对话框,但我似乎无法引用用户提供的输入.

                  I am trying to create a prompt dialog box using alertifyjs that has multiple input boxes. I have managed to create the dialog box to show the multiple boxes but I cant seem to make a reference to the inputs that user provides.

                  我想编写 if 语句,当用户按下 OK 时根据用户输入执行操作.但是,确定"按钮似乎不起作用,并且 if 语句也不起作用.我不确定我可能做错了什么,有人可以帮助我.

                  I want to write if statement that carries out action based on user input when they press OK. However, the OK button doesnt seem to be working and also the if-statements don't work as well. I am not sure what I might be doing wrong, can someone please help me.

                  下面是我的代码:

                  <!DOCTYPE html>
                  <html>
                  <head>
                       <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/alertify.min.css"/>
                      <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/themes/bootstrap.min.css"/>
                      <script src="//cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/alertify.min.js"></script>
                  
                  
                  </head>
                  
                  <body> 
                  
                  <div style="display:none;" >
                      <div id="dlgContent">
                          <p> Enter Value One </p>
                          <input class="ajs-input" id="inpOne" type="text" value="Input One Default Value"/> 
                  
                          <p> Enter Value Two </p>
                          <input class="ajs-input" id="inpTwo" type="text" value="Input two default Value"/> 
                  
                      </div>
                  </div>
                  
                  <!-- the script  -->
                  
                  <script>
                    var dlgContentHTML = $('#dlgContent').html();
                  
                  $('#dlgContent').html(""); 
                  alertify.confirm(dlgContentHTML).set('onok', function(closeevent, value) { 
                                      var inpOneVal = $('#inpOne').val();
                                      var inpTwoVal = $('#inpTwo').val();
                                      updateListItems(inpOneVal,inpTwoVal);   
                                    if (inpOneVal == "test" && inpTwoVal == "test") {
                                        alertify.success('Successful');
                                     } else {
                                        alertify.error('Wrong')
                  
                                      }
                                  }).set('title',"Update");
                   </script>
                  
                  </body>   
                  </html>
                  

                  JSfiddle 链接:http://jsfiddle.net/1qouxdkc/4/p>

                  Link to JSfiddle: http://jsfiddle.net/1qouxdkc/4/

                  推荐答案

                  在你的脚本中调用一个名为 updateListItems(inpOneVal,inpTwoVal);

                  In your script you call a function named updateListItems(inpOneVal,inpTwoVal);

                  由于该函数未在任何地方声明,因此会出错,因此暂时将其注释掉,它可以工作.

                  As that function is not declared anywhere, it errors, so with that temporarily commented out, it works.

                  堆栈片段

                  <html>
                  
                  <head>
                    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/alertify.min.css" />
                    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/themes/bootstrap.min.css" />
                    <script src="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/alertify.min.js"></script>
                  
                  </head>
                  
                  <body>
                  
                    <div style="display:none;">
                      <div id="dlgContent">
                        <p> Enter Value One </p>
                        <input class="ajs-input" id="inpOne" type="text" value="Input One Default Value" />
                  
                        <p> Enter Value Two </p>
                        <input class="ajs-input" id="inpTwo" type="text" value="Input two default Value" />
                  
                      </div>
                    </div>
                  
                    <!-- the script  -->
                  
                    <script>
                      var dlgContentHTML = $('#dlgContent').html();
                  
                      $('#dlgContent').html("");
                      alertify.confirm(dlgContentHTML).set('onok', function(closeevent, value) {
                        var inpOneVal = $('#inpOne').val();
                        var inpTwoVal = $('#inpTwo').val();
                        //updateListItems(inpOneVal,inpTwoVal);	
                  
                        if (inpOneVal == "test" && inpTwoVal == "test") {
                          alertify.success('Successful');
                        } else {
                          alertify.error('Wrong')
                  
                        }
                      }).set('title', "Update");
                    </script>
                  
                  </body>
                  
                  </html>

                  这篇关于多个输入框 - alertifyjs/Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何通过反应将数据从对话框发送回父容器? 下一篇:如何关闭新的html&lt;对话框&gt;通过单击其

                  相关文章

                  最新文章

                  <i id='zFVQf'><tr id='zFVQf'><dt id='zFVQf'><q id='zFVQf'><span id='zFVQf'><b id='zFVQf'><form id='zFVQf'><ins id='zFVQf'></ins><ul id='zFVQf'></ul><sub id='zFVQf'></sub></form><legend id='zFVQf'></legend><bdo id='zFVQf'><pre id='zFVQf'><center id='zFVQf'></center></pre></bdo></b><th id='zFVQf'></th></span></q></dt></tr></i><div id='zFVQf'><tfoot id='zFVQf'></tfoot><dl id='zFVQf'><fieldset id='zFVQf'></fieldset></dl></div>

                      <bdo id='zFVQf'></bdo><ul id='zFVQf'></ul>
                  1. <legend id='zFVQf'><style id='zFVQf'><dir id='zFVQf'><q id='zFVQf'></q></dir></style></legend>

                    1. <tfoot id='zFVQf'></tfoot>

                      <small id='zFVQf'></small><noframes id='zFVQf'>