Colleen Gerber
Colleen Gerber

Reputation: 1

Gravity Forms Dropdown List Display

I created a dropdown list of time - 1 min to 60 mins. When it displays, it is not in sequential order but places all the "1's" together (ie: 1,12,19), then the twos, and so forth. I need it to be 1 through 60. What do I need to include?

I'm a newbie in code but I did try looking for a style command or custom css class for sequential with no luck.

Upvotes: 0

Views: 46

Answers (1)

Krushna Konda
Krushna Konda

Reputation: 1

To ensure that the dropdown list displays the numbers 1 through 60 in sequential order, you can try adding custom JavaScript code to sort the options alphabetically. Here's a simple example of how you can achieve this using jQuery:

jQuery(document).ready(function($) {

    var dropdown = $('#dropdown-id');
    
    var options = dropdown.find('option');
    
    options.sort(function(a, b) {
        return parseInt($(a).text()) - parseInt($(b).text());
    });
    
    dropdown.html(options);
});

Upvotes: 0

Related Questions