TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vasanthakumar m
NA
174
9.4k
Javascript Issue (For Loop)
Jul 5 2020 6:28 AM
Hi Techiee,
I have 100 number of paragraph binding from database to Html code using List in mvc. But Inside each Paragraph i need to give one Br tag. Where the one sentence finished.
Here i attached my code and javascript.
But My code will give the Br tag for First paragraph.Rest of 99 paragraph Br tag is not taking it, Any Solution for it.
Ex:(Paragraph)
What is Lorem Ipsum Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard. Dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book it
<html>
<head>
</head>
<body onload=
"myFunction()"
>
@foreach (ImgViewModel ourteamdesc
in
Model.OurTeamDesc)
{
<div id=
"demo"
>
<p>@tbl.Designation</p>
</div>
}
<script>
function
myFunction() {
var
str = document.getElementById(
"demo"
).innerHTML;
var
res = str.split(
"."
).join(
"<br />"
);
document.getElementById(
"demo"
).innerHTML = res;
}
</script>
</body>
</html>
Reply
Answers (
3
)
How to access values from 2 datatable as tabel1.tabel2.columnname in C
Menu from Horzantal to Veritical