prashantcs053
7/3/2017 - 1:15 PM

generate List Number for gravity form list field

generate List Number for gravity form list field

function genrateListNumber() {
    if (jQuery(".gfield_list_group").length > 0) {
        var increament = 1;
        jQuery(".gfield_list_group").each(function () {
            var table_lable = "Location " + increament;
            jQuery(this).find(".add_location_number").remove();
            jQuery(this).children('td[data-label="Column 1"]').prepend("<label class='gfield_label add_location_number'>" + table_lable + "</label>");
            jQuery(this).children(".gfield_list_icons").attr("delete_title", table_lable);
            increament++;
        });
    }
}

 if (typeof gform != 'undefined') {
        gform.addAction('gform_list_post_item_add', function (item, container) {
         genrateListNumber();
             });
    }
    
  jQuery(document).bind('gform_post_render', function (event, formId, current_page) {
       genrateListNumber();
    });
    gform.addAction('gform_list_post_item_delete', function ($elem, $container, map_lat, map_lng) {
        genrateListNumber();
    });