/*
--------------------
Custom form js
--------------------
*/

(function($){
    $('abbr.sq-form-required-field').text('(required)');
    if($('.sq-form-question-datetime').length){
        
        // Matrix date field, show placeholder for dropdown boxes
        $('.sq-form-question-datetime select[name$="[d]"]').each(function(){
            $(this).find('option').each(function(){
                let $option = $(this);
                if($option.attr('value') == '--'){
                    $option.text('dd')
                }
            });
        });
        $('.sq-form-question-datetime select[name$="[m]"]').each(function(){
            $(this).find('option').each(function(){
                let $option = $(this);
                if($option.attr('value') == '--'){
                    $option.text('mm')
                }
            });
        });
        $('.sq-form-question-datetime select[name$="[y]"]').each(function(){
            $(this).find('option').each(function(){
                let $option = $(this);
                if($option.attr('value') == '--'){
                    $option.text('yyyy')
                }
            });
        });
        
    }
    
    // custom datetime field with custom bodyformat
    // need to add class="date" to each field
    $('select.date').parent().css({'display': 'inline-block'});
}(jQuery));
