gpt4 book ai didi

javascript - 使字符串 initcap 就像我在文本框中输入 paul james 一样,它应该给我 Paul James

转载 作者:行者123 更新时间:2023-12-03 08:51:10 24 4
gpt4 key购买 nike

制作字符串 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;}

示例:http://jsfiddle.net/wgLao126/

关于javascript - 使字符串 initcap 就像我在文本框中输入 paul james 一样,它应该给我 Paul James,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32665125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com