JSFiddle - React, Tailwind, and code Playground

HTML

<div class="title">me & you 
 <div class="subtitle">me & you</div>
</div> 
<br /> 
<div class="title">me & you</div>

JavaScript

function capitalise(str) {
    if (!str) return;
    var stopWords = ['a', 'an', 'and', 'at', 'but', 'by', 'far', 'from', 'if', 'into', 'of', 'off', 'on', 'or', 'so', 'the', 'to', 'up'];
    str = str.replace(/\b\w+\b/ig, function(match) {
        return $.inArray(match, stopWords) == -1 ? match.substr(0, 1).toUpperCase() + match.substr(1) : match;
    }); 
    return str;
}

function getTextNodesIn(node, includeWhitespaceNodes) {
    var textNodes = [], whitespace = /^\s*$/;

    function getTextNodes(node) {
        if (node.nodeType == 3) {
            if (includeWhitespaceNodes || !whitespace.test(node.nodeValue)) {
                textNodes.push(node);
            }
        } else {
            for (var i = 0, len = node.childNodes.length; i < len; ++i) {
                getTextNodes(node.childNodes[i]);
            }
        }
    }

    getTextNodes(node);
    return textNodes;
}


var textNodes = getTextNodesIn(document.body);
for (var i = 0; i < textNodes.length; i++) {
     var textNode = textNodes[i];
     textNode.parentNode.replaceChild(document.createTextNode(capitalise( $(textNode).text() ) ), textNode); 
}