The contenteditable attribute does not work

4
<input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input" contenteditable="false" value="[email protected]">

I'm having trouble making the input content not editable, because later, the input value will be placed via php, and the user will not be able to edit their email unless it is a site adm

    
asked by anonymous 29.08.2016 / 16:07

2 answers

3

contenteditable="false" does not work in input, do so ( readonly )

<input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input" readonly value="[email protected]">

So you can still position the cursor there, but if you do not want you can always put disable :

<input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input" disabled value="[email protected]">
    
29.08.2016 / 16:17
2

Just add the readonly attribute.

<input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input"  value="[email protected]" readonly>

Read more about the readonly attribute in: HTML readonly Attribute

    
29.08.2016 / 16:16