Skip to content Skip to sidebar Skip to footer

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?

Solution 1:

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();
}

Solution 2:

div.title {text-transform:uppercase;}

Post a Comment for "Display Letters In All Capitals In A Block"