Help Desk

Customize the minutes available in select for starting and ending date/time?

  • Posts: 8 Topics: 5
    | Permalink

    Hi, in the community events form, I’d like to be able to restrict the options available in the minutes select box from “05, 10, 15, 20…” etc to just “00” and “30”.

    Is this possible?

    Posts: 3519 Answers: 115
    | Permalink

    Thanks for getting in touch! You should be able to do this with some custom CSS. Try pasting the following code snippet into your theme’s functions.php file:

    This should only add the CSS when viewing the event submission form, so hopefully that will do the trick for you.

    Just let me know if need anything else! Thanks! 🙂


    Posts: 8 Topics: 5
    | Permalink

    Thanks for the quick response! I added the code to my functions.php, and I see the code getting added when I view source, but the select options remain the same.

    Posts: 8 Topics: 5
    | Permalink

    Seems to be a browser issue. Firefox mostly works, but Chrome and Safari do not. Did some research and it looks like hiding select options is not well supported cross browser. Do you know of any workarounds?

    Posts: 8 Topics: 5
    | Permalink
    Correct Answer

    Ok I think I have this working, using jquery. Based my work off here:
    This is the code I used, add to my .js file:

    //remove select options
    $(“#tribe-event-datepickers select option[value=’05’]”).remove();
    $(“#tribe-event-datepickers select option[value=’10’]”).remove();
    $(“#tribe-event-datepickers select option[value=’15’]”).remove();
    $(“#tribe-event-datepickers select option[value=’20’]”).remove();
    $(“#tribe-event-datepickers select option[value=’25’]”).remove();
    $(“#tribe-event-datepickers select option[value=’35’]”).remove();
    $(“#tribe-event-datepickers select option[value=’40’]”).remove();
    $(“#tribe-event-datepickers select option[value=’45’]”).remove();
    $(“#tribe-event-datepickers select option[value=’50’]”).remove();
    $(“#tribe-event-datepickers select option[value=’55’]”).remove();

    Posts: 3519 Answers: 115
    | Permalink

    Great! Glad to hear that you were able to get this one sorted on your own. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out.

    By the way, if you have a minute or two, we would love it if you’d write a few words for us here:

    Thanks in advance. 🙂