나는 최대 30 자 (완전한 문자)를 표시하는 데모를 만들고있다. 괜찮아 질 것이다.하지만 내 주어진 문자열에 br 태그가있을 때 내 문제가 실패한다. 우리 모두가 그 브레이크 라인을 알고 있으므로 .so 내가 원한다. 언제 내가 언제 브래그 태그를 발견했는지 깨기. 제가 문자열이 때jquery를 사용하여 문자열에서 br 태그를 검색하는 방법은 무엇입니까?
var str = "Ben Nadel reviews the various approaches to Sachin Ramesh Tendulkar is a former Indian cricketer widely acknowledged as the greatest batsman of the modern generation, popularly holds the title among his fans Sachin Ramesh Tendulkar is a former Indian cricketer widely acknowledged as the greatest batsman of the modern generation, popularly holds the title among his fansSachin Ramesh Tendulkar is a former Indian cricketer widely acknowledged as the greatest batsman of the modern generation, popularly holds the title among his fans substring";
출력 : 괜찮
Ben Nadel reviews the various
approaches to Sachin Ramesh
Tendulkar is a former Indian
cricketer widely acknowledged
as the greatest batsman of the
modern generation, popularly
holds the title among his
fans Sachin Ramesh Tendulkar
is a former Indian cricketer
widely acknowledged as the
greatest batsman of the modern
generation, popularly holds
the title among his
fansSachin Ramesh Tendulkar is
a former Indian cricketer
widely acknowledged as the
greatest batsman of the modern
generation, popularly holds
the title among his fans
substring
한다. 그러나 문자열에 br 태그를 추가하면 개념이 30자를 표시하지 못합니다.
br string
var str = "Ben Nadel <br /> reviews the various approaches to Sachin Ramesh Tendulkar is a former <br /> Indian cricketer widely acknowledged as the greatest batsman of the modern <br /> generation, popularly holds the title among his fans Sachin Ramesh Tendulkar is a former Indian cricketer <br /> widely acknowledged as the greatest batsman of the modern generation, popularly holds the title among his fansSachin Ramesh Tendulkar is a former Indian cricketer widely acknowledged as the greatest batsman of the modern generation, popularly holds the title <br /> among his fans substring";
Ben Nadel // explain here user find br tag it fine to go next line
reviews the // why not it display 30 characters ?
various approaches to Sachin
Ramesh Tendulkar is a former
//why boac space display
Indian cricketer widely
acknowledged as the greatest
batsman of the modern
generation, popularly holds
the title among his fans
Sachin Ramesh Tendulkar is a
former Indian cricketer
widely acknowledged as the
greatest batsman of the modern
generation, popularly holds
the title among his
fansSachin Ramesh Tendulkar is
a former Indian cricketer
widely acknowledged as the
greatest batsman of the modern
generation, popularly holds
the title //why 30 character not display ?
among his
fans substring
문자열에 br 태그가 있으면 줄 바꿈을하고 다시 30 자 (전체 단어)를 표시합니까? 이 작업을 수행 할 수 있습니까? http://jsfiddle.net/yzaaJ/11/
for(var index = 0; index < words.length; index++)
{
var currentWord = words[index];
var currentLength = tenLengthString.length;
if(((currentLength + currentWord.length + ((currentLength > 0) ? 1: 0))) > 30)
{
html+='<div>'+tenLengthString+'</div>';
console.log(tenLengthString);
tenLengthString = currentWord;
} else {
if(currentLength > 0)
tenLengthString += " ";
tenLengthString += currentWord;
}
if(index == words.length - 1){
console.log(tenLengthString);
html+='<div>'+tenLengthString+'</div>';
}
}
$("#test").html(html)
당신은 내가 넣어이 벤 나델 벤 나델이 Sachin 라 메쉬 Tendulkar는가에 다양한 방법을 검토되어 다시 –