我不太了解jquery。我在下面提到了脚本
var header = $('.time'+col).text();
alert(header);
我从那里得到了字符串“ 109:00AM”,该字符串是如何获得第一个字母(例如1)的。请您帮我一下。
试试charAt(0)
喜欢
var header = $('.time'+col).text();
alert(header.charAt(0));
您也可以使用substring
像
alert(header.substring(1));
正如@Jai说,你可以使用slice
也喜欢
alert(header.slice(0,1));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句