I have encountered a situation where I need to change the HTML link values from UPPERCASE to LOWERCASE and then apply a capitalization style. The problem lies in the fact that the links arrive in uppercase, so I had to come up with a workaround:
The given HTML code:
<div class="block1">
<p><a href="#">SECTION TITLE</a></p>
<ul>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
<li><a href="#">LINK TITLE</a></li>
</ul>
</div>
The jQuery solution implemented:
jQuery('.block1 ul li a').each(function() {
var linkText = jQuery(this).html();
linkText.toLowerCase();
jQuery(this).css("text-transform", "capitalize");
});
Currently, even though I added linkText.toLowerCase();
, I am not observing the conversion to lowercase. All I see is the application of the text-transform property to capitalize the text of each link.