First letter to be capitalize Jquery

This question already has an answer here:

  • How do I make the first letter of a string uppercase in JavaScript? 69 answers

  • 干得好:

    data[0] = data[0].toUpperCase();


    使用Javascript Prototype ..

    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.slice(1);
    }
    
    
    var test = "hello";
    
    console.log(test.capitalize())
    链接地址: http://www.djcxy.com/p/17874.html

    上一篇: / dev / random是否真的是随机的?

    下一篇: 首字母大写Jquery