2

I use html-placeholder in apex:selectList with a few selectOptions, but it's not displayed. What can I use to fix it?

<apex:selectList html-placeholder="Text here" size="1">
     <apex:selectOptions value="{!options}"/>
</apex:selectList>

Apex:

public List<SelectOption> options{get;set;}

public Class(){
    options= new List<SelectOption>();
    options.add(new SelectOption('',''));
    options.add(new SelectOption('5','5'));
    options.add(new SelectOption('10','10'));
}

1 Answer 1

6

HTML's select does not have a placeholder attribute. Instead, you can just specify a different label and value on the first entry:

options.add(new SelectOption('','-- select --'));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .