Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 jquery 的了解很差。我已经提到了下面的脚本
var header = $('.time'+col).text(); alert(header);
我从如何获取第一个字母(例如 1)中得到字符串为“109:00AM”。请您帮帮我。
试试charAt(0)喜欢
charAt(0)
var header = $('.time'+col).text(); alert(header.charAt(0));
你也可以使用substring喜欢
substring
alert(header.substring(1));
正如@Jai所说,您也可以slice使用
slice
alert(header.slice(0,1));