Switch capital letters to lower case letters

Asked

Viewed 2,436 times

2

I have a richfaces datatable component that returns a database record and this record comes with uppercase letters.

Example: PAULO FERNANDES DA SILVA.

There would be something I could do to edit this name with CSS for Paulo Fernandes Da Silva to be shown in the datatable?

Ps.: I am using HTML4.

1 answer

3

One possibility is to convert the name to lower case before inserting into HTML, and then styling with text-transform: capitalize;

var nome = 'PAULO FERNANDES DA SILVA';

document.getElementById('nome').innerHTML = nome.toLowerCase();
#nome {
  text-transform: capitalize;
}
<p id="nome"></p> <!-- Paulo Fernandes Da Silva -->

  • variable name is static. But it comes from the database, as I can do for it to receive this data from the database with javascript?

  • 1

    I don’t know. You put the javascript tag, I thought you were already getting the data for it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.