I'm creating a script to rewrite the local version of the ETrack system my college uses as it's horrific, and I have a bit of an issue with formatted text. You see, there's a div on this system with the class .visitFeedback
, and in this Div it has loads of <p>
tags. I want to move these paragraphs into a scrollable div due to the paragraphs overflowing normally. The only issue is, these paragraphs have HTML styling within them ( <strong>
etc.). I want to reserve this formatting and just add it into a scrollable Div. So far I've managed to move it over, but all the methods I've tried so far return stuff like [object HTMLParagraph]
instead of the text I want. So far I've tried .get()
, .html()
, .text()
, and a few others. Can you please help? The relevant stuff is below:
var feedbackTxt;
$('.visitFeedback p').each(function(){
if ($(this).hasClass('info'))
{
}
else
{
feedbackTxt += $(this).text();
$(this).remove();
}
});
$('.visitFeedback').append('<div style="overflow-y: scroll;">' + feedbackTxt + '</div>');
为什么不添加overflow-y: scroll
到.visitFeedback
类的元素?
$('.visitFeedback').css('overflow-y', 'scroll');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.