$('.custom-menu-primary ul li > a > .menu-item-text').each(function () { if ($(this).html().indexOf('<br>') != -1) { var title = $(this).html().split('<br>')[0]; var desc = $(this).html().split('<br>')[1]; if (title == undefined) { var titleText = ''; } else { var titleText = '<span class="menu-text">' + title + '</span>'; } if (desc == undefined) { var descText = ''; } else { var descText = '<span class="menu-desc">' + desc + '</span>'; } var finalText = titleText + descText; $(this).html(finalText); } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter