We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Input box appearance manipulation

I created a text box where the placeholder moves out of the way when the text box gets focus:

     <input id="username" class="e-input">

Then in javascript file:

     var inputobj1 = new ej.inputs.TextBox({
        placeholder: 'Username',
        floatLabelType: 'Auto',
    });
    inputobj1.appendTo('#username');


How can I change the colors and the fonts?  Are there other parameters for "ej.inputs.TextBox"?

3 Replies

CI Christopher Issac Sunder K Syncfusion Team December 20, 2018 10:13 AM UTC

Hi Travis, 

Thank you for contacting Syncfusion support. 

We have validated your query in TextBox component. You can customize the input element’s font color and size by using cssClass property which is used to add the new class at root element of the input element. 
Please refer the below code snippet 

[scripts] 
var inputobj1 = new ej.inputs.TextBox({ 
    placeholder: 'Username', 
    floatLabelType: 'Auto', 
    cssClass: 'newClass' 
}); 
inputobj1.appendTo('#username'); 
 
[style] 
.e-float-input.e-control-wrapper.newClass { 
     color: blue; 
     font-size: 18px; 
} 
 
For you convenience, we have prepared simple MVC TextBox sample and get that sample in the below location, 
 

Please let us know if you need any further assistance. 

Thanks,
Christo



TR Travis December 20, 2018 10:27 PM UTC

Hi Christo:

Thanks for the info, this is great.

Now how do I change the font and color of the placeholder as well as the color of the bottom border/line?

Attachment: pict_793062a7.zip


PO Prince Oliver Syncfusion Team December 21, 2018 05:57 AM UTC

Hi Travis, 

Thank you for your update. 

To change the font and color of the placeholder and the color of the bottom border line, kindly override the following styles. 

<style> 
    .e-float-input.e-control-wrapper.newClass:not(.e-error) input:focus ~ label.e-float-text { 
        color: rgba(10, 163, 0, 1); 
        font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    } 
    .e-float-input.e-control-wrapper.newClass:not(.e-input-group) .e-float-line::before, 
    .e-float-input.e-control-wrapper.newClass:not(.e-input-group) .e-float-line::after { 
        background: rgba(10, 163, 0, 1); 
    } 
</style> 

We have attached the modified sample for your reference, please find the sample at the following location: http://www.syncfusion.com/downloads/support/forum/141599/ze/EJ2-MVC-TextBox-customization283595137  

Please let us know if you need any further assistance on this. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon