【问题标题】:Use two next button in twitter bootstrap form wizard在 twitter 引导表单向导中使用两个下一步按钮
【发布时间】:2015-10-13 11:53:08
【问题描述】:

我在我的 twitter 引导表单向导中使用了两个下一个按钮 (.button-next)。第一个带有“保存”标签,第二个带有“保存并继续”标签。现在,在 onNext 事件中,我如何跟踪请求来自哪个按钮?

我尝试使用 $(this).text(); 获取按钮文本,但不起作用。

代码:

onNext: function (tab, navigation, index) {
                    success.hide();
                    error.hide();

                    if (form.valid() == false) {
                        return false;
                    }

                    if (index === 2)
                    {
                        if($(this).text() === 'save') // this condition is not working
                        {
                            return false; 
                        }

                        var url = $('#desurl').val();
                        var language = $('#language').val();
                        var description = $('#description').val();
                        var features = $('#features').val();


                        $.ajax({
                            method: "POST",
                            url: url,
                            data: { language : language, description : description, features : features },
                            dataType: "json",
                            complete: function(){

                            }
                        });
                    }

                    handleTitle(tab, navigation, index);
                }

【问题讨论】:

  • 你能发布当前代码吗?
  • @ManojKumar 代码添加

标签: jquery twitter-bootstrap twitter


【解决方案1】:

 <form action="demo,php" method="post">
  <button name="whichbutton" type="submit" value="btn1">Save</button>
  <button name="whichbutton" type="submit" value="btn2">Save on Continue</button>
</form> 

如果是 php

回显 $POST["whichbutton"]

链接:http://www.w3schools.com/tags/att_button_value.asp

【讨论】:

  • 我已经明确提到它在“twitter bootstrap form wizard”中。请先仔细阅读问题。
猜你喜欢
  • 2016-02-02
  • 2017-08-03
  • 1970-01-01
  • 1970-01-01
  • 2018-08-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多