• Resolved luizarusso

    (@luizarusso)


    Hey there!
    Does anyone know if it’s possible to load the select option already selected once theres only one option available? I couldn’t find that option in the painel.

    Instead of the placeholder, load it with the only possible option selected.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor sarkparanjothi

    (@sarkparanjothi)

    You can choose Default Options from admin field meta editor.

    Or inser below script into your theme js file.

    
    jQuery( document ).ready(function(){
       var selects = jQuery( "select.wccpf-field " );
       for( var i = 0; i < selects.length; i++  ){
          var select = jQuery( selects[i] );
          if( select.find( "option" ).length == 1 ){
              select.val( jQuery( select.find( "option" )[0] ).val() );
          } else if( select.find( "option" ).length == 2  ){
             if( jQuery( select.find( "option" )[0] ).val() == "wccpf_none" ){
                select.val( jQuery( select.find( "option" )[1] ).val() );
             }
          }
       }
    
    });
    Thread Starter luizarusso

    (@luizarusso)

    In fact it was possible by removing the placeholder lol. Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fixed option when there’s only one option’ is closed to new replies.