How to add placeholder attribute to JSF input component?

后端 未结 9 810
耶瑟儿~
耶瑟儿~ 2020-11-28 09:19

Shouldn\'t this line of code render a inputtext field with the placeholder text \"fill me\" when using html5?


         


        
相关标签:
9条回答
  • 2020-11-28 09:47

    <h:head>
    </h:head>
    <h:body>
        <h:inputText value="#{bean.value}" placeholder="fill me"/>
    </h:body>
    

    This works right for me, try it!

    0 讨论(0)
  • 2020-11-28 09:49

    The simplest way to render an input field with a placeholder text is to use the elementary input tag

    Example:

    <input type="text" placeholder="Fill me" value="#{EL}"/>
    

    Note: you dont have to include any namespaces

    0 讨论(0)
  • 2020-11-28 09:53

    Try this

    <h:inputText id="name" value="#{login.userId}" class="aux1" />
    <h:inputSecret id="password" value="#{login.password}" redisplay="true" class="aux2" autocomplete="off" />
    
    <script>
      $('.aux1').attr('placeholder', 'Introducir Usuario');
      $('.aux2').attr('placeholder', 'Introducir Contraseña');
    </script>
    

    With jQuery, this works right for me.

    0 讨论(0)
提交回复
热议问题