Search code examples
javascriptjquerydialogtabindex

Over writing tabindex not working in dialog


//tab index test
    $("#txtProductName").attr('tabindex', 1);
    $("#txtQty").attr('tabindex', 2);
    $("#txtProductLine").attr('tabindex', 3);      
    $("#txtFeeType").attr('tabindex', 4);
    $("#ddlBillingFrequency").attr('tabindex', 5);
    $("#txtAssetStartDate").attr('tabindex', 6);
    $("#txtAssetEndDate").attr('tabindex', 7);
    $("#txtLineType").attr('tabindex', 8);
    $("#txtARBSId").attr('tabindex', 9);
    $("#txtTotalValue").attr('tabindex', 10);
    $("#ddlProductTypeList").attr('tabindex', 11);
    $("#ddlBillingMilestoneList").attr('tabindex', 12);
    $("#txtCompanyCode").attr('tabindex', 13);        
    $("#txtActivityCodeId").attr('tabindex', 14);
    $("#txtCostCodeId").attr('tabindex', 15);

I have a dialog box in which I render a partial view with some labels,text boxes and drop down lists with a save and close button. By default it has across tabbing I want vertical tabbing. So I set tab indexes as per need. But it results in not tabbing means controls on which I set tab index it don't get focus anymore on pressing tab. Basically I want to overwrite auto assigned tab index. Please help. Thanks


Solution

  •     $("#txtProductName").attr('tabindex', 15);
        $("#txtQty").attr('tabindex', 16);
        $("#txtProductLine").attr('tabindex', 17);      
        $("#txtFeeType").attr('tabindex', 18);
        $("#ddlBillingFrequency").attr('tabindex', 19);
        $("#txtAssetStartDate").attr('tabindex', 20);
        $("#txtAssetEndDate").attr('tabindex', 21);
        $("#txtLineType").attr('tabindex', 22);
        $("#txtARBSId").attr('tabindex', 23);
        $("#txtTotalValue").attr('tabindex', 24);
        $("#ddlProductTypeList").attr('tabindex', 25);
        $("#ddlBillingMilestoneList").attr('tabindex', 26);
        $("#txtCompanyCode").attr('tabindex', 27);
        $("#txtActivityCodeId").attr('tabindex', 28);
        $("#txtCostCodeId").attr('tabindex', 29);
    

    As I am rendering a partial view I need to assign tab index according tab indexes assigned on a main view. So I just assigned tab indexes in continuation of the main view's tab indexes and it works. :)