Remove empty space on select option

I always get an empty option in the select field types, even though I defined a default option and add correct field types ‘select’. need suggestion and help how to solve this,

{
“options”: “Live, Under Maintenance”,
“default”: “Live”
}

Hi @hafizi :slightly_smiling_face:,
Did you solve your problem with your empty option ?
I tried this solution but it doesn’t work for me…

Currently there is always an empty option rendered with the other select options

You could create a JS script, that is loaded after rendering and removing the first empty option.
Or use a CSS block.

// config/bootstrap.php

$app->on('collections.entry.aside', function ($collectionName) {
  echo "
<style>
 select[bind^=\"entry\"] > option[value=\"\"]:first-child{ display: none; }
</style>
  ";
});

1 Like

Thanks abernh, :slight_smile:
I’ll do that!!!