Change text to uppercase in jQuery
Description
The following code shows how to change text to uppercase.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w w w. j a v a2 s . c o m-->
var mappedItems = $("li").map(function(index) {
var data = $("<li>").text($(this).text()).get(0);
$(data).text($(data).text().toUpperCase());
return data;
});
$("#results").append(mappedItems);
});
</script>
</head>
<body>
<ul>
<li>java2s.com</li>
<li>java2s.com</li>
<li>java2s.com</li>
</ul>
<ul id="results">
</ul>
</body>
</html>