Display letters in all capitals in a block

I have a div with class "title". How do I display all letters in capitals in this block?

Answers:

Answer

CSS can do that

.title {text-transform : uppercase;}

or jQuery

$('.title').text(function(_, txt) {
    return txt.toUpperCase();
});

or plain Javascript

var elems = document.querySelectorAll('.title');

for (var i=elems.length; i--;) {
    elems[i].textContent = elems[i].textContent.toUpperCase();
}
Answer
div.title {text-transform:uppercase;}

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.