0

I am trying to color the text Enter Valid Email in Red how can i achieve this Please Help

email_validation.js

$('#email').focusin(function()
{
    $('#email_feed').text('Enter Valid Email...');
})
Chathuranga Silva
  • 6,915
  • 2
  • 47
  • 54
kunz
  • 895
  • 1
  • 7
  • 26

3 Answers3

1
$('#email').focusin(function()
{
    $('#email_feed').html('<span style="color:red;">Enter Valid Email...</span>');
})
madalinivascu
  • 31,556
  • 4
  • 35
  • 52
1

Use .css property

$('#email_feed').text('Enter Valid Email...').css('color','red');
Guruprasad J Rao
  • 29,031
  • 13
  • 99
  • 190
0

You can either use css

#email_feed
{ 
    color: #F00;
}

Or you could continue using jquery and use

$('#email_feed').text('Enter Valid Email...').css({ color : "#F00" )};

Both will achieve the same result

samuelmr
  • 607
  • 3
  • 10