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.
JavaScriptで特定の文字数の後に文字列を切り取るにはどうすればよいですか?
次に、「…」Unicode 文字を追加します。これどうやってするの?
var trucatedText = yourtext.substring(0, 3) + '...'; // substring(from, to);
こんなの?
var text= "This is your text"; var stripHere = 7; var shortText = text.substring(0, stripHere) + "..."; alert(shortText);
http://jsfiddle.net/ThKsw/