jquery - javascript capitalization -
var font_name = $(".font").val(); i have in javascript code. in html have input form class .font.
i want capitalize first letter of each word in .font, example if types in lucida sans it'll turn lucida sans. couldn't find jquery method guess have use actual javascript have no idea how.
var font_first = font_name.substr(0,1); var font = font_first.touppercase() + font_name.substr(1, font_name.length - 1); i used capitalize first letter of whole font name said need capitalize first letter of each word.
can not use css?
.font { text-transform: capitalize; } in jquery:
$(".font").css("text-transform","capitalize");
Comments
Post a Comment