How to Change the Background Color of a Read Only Input Field

1 year ago admin Css

In this lesson, we will see how to change the background color of a read-only input field, as you know the read-only input field cannot be modified and in some cases, we want to change the background color from grey to white.


Change the background color from grey to white

To do that, check the code below:

                                                    
                                                                                                                
<input type="email" id="email" name="email" class="form-control" 
   readonly onfocus="this.removeAttribute('readonly');" 
   style="background-color: #ffffff"/>