选项卡中的jQuery验证 [英] Jquery validation in tabbed

查看:104
本文介绍了选项卡中的jQuery验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我一直在尝试的东西.

Here is what i've been trying.

一个表单将具有三个标签,如上.

A form will have three tab ,like the above.

每次使用时都单击特定的选项卡并尝试填充数据,它已经验证了文本框的空白验证.

When ever use clicks particular tab and try to fill data,it has validate the empty vaidation for text boxes.

当用户单击第一个选项卡并在文本框id ="textbox_four"中填充一些数据时,然后,如果他单击下一个选项卡,则该数据必须在id ="textbox_five"中,单击第三项时相同标签,它必须在"textbox_six"中,数据必须不断传递.

When user clicks the first tab and fill some data in text box id="textbox_four" ,then if he clicks the next tab,it data has to be there in id="textbox_five",the same when he click the third tab,it has to be there in "textbox_six",data has to keep passing.

http://jsfiddle.net/CuA9V/2/

如果您能在这里找到一些启示,那就太好了.

It would be great,if you can shed some light here.

任何帮助将不胜感激

推荐答案

这将使它们保持同步.我那是你在问什么?大声笑

This will keep them all in sync. I think that is what you are asking? lol

$('#textbox_four, #textbox_five, #textbox_six').keyup(function(){
    $('#textbox_four').val($(this).val());
    $('#textbox_five').val($(this).val());
    $('#textbox_six').val($(this).val());
});

您可以在验证过程中检查选定的标签,如下所示

you can check the selected tab during validation as below

$('#submitButton').click(function()
{
    var selected = $("#tabs").tabs('option', 'selected');

    if (selected == 0) {
        // Do this
    } else if (selected == 1) {
        // Do that
    } else if (selected == 2) {
        // Etc
    }
};

已更新: http://jsfiddle.net/trapper/CuA9V/5/

这篇关于选项卡中的jQuery验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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