制作字符串 initcap 就像我在文本框中输入 paul james 一样,它应该给我 Paul James ..使用带或不带内置函数的 javascript 来完成它....制作字符串 initcap ?
简要:我不想使用任何内置的 javaacript 函数,例如 split 和 all...我只想初始化 cap,即“My Name Is Init Cap”..我希望我的字符串采用这种格式,而不需要 split 和 all
<input type="text" placeholder="enter string"/>
<button>make string uppercase</button><!--like Paul James if i enter paul james-->
最佳答案
当你可以使用 CSS 时,为什么还要使用 javascript?
button:focus{text-transform:capitalize;}
关于javascript - 使字符串 initcap 就像我在文本框中输入 paul james 一样,它应该给我 Paul James,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32665125/