مهراب تاجیک
2 سال پیش توسط مهراب تاجیک مطرح شد
1 پاسخ

نمایش قسمتی از متن با HTML

this

سلام چطوری کاری کنم که باHTML(یا کلا سمت کاربر) ، یک متنی که از سرور میاد رو بعنوان مثال 50کاراکتر اولشو نمایش بده و بحای بقیش سه نقطه بزاریم مثل عکس بالا


ثبت پرسش جدید
عبدالرحمان کیانی
تخصص : Backend developer
@abdolrahman 2 سال پیش آپدیت شد
1

با جاوا اسکریپت میتونین انجام بدین به این صورت

<p> 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 has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </p>
let p = document.querySelector('p')
p.innerHTML = p.innerHTML.substr(0,50) + '...'

برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام