Outputting post content to jQuery .html() string

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com

everyone.

I’m trying to create a tooltip that appears over a specific word (an a tag) inside a paragraph, inside a post content that’s being displayed on my page. I managed to add a class (“office”) to said paragraph from Gutenberg, which I’m using on the front end to target the anchor tag inside it and perform a jQuery .html() to add more content to that a tag (besides the text) which is the tooltip div. The contents of this tooltip div needs to be a specific post’s content. Please note that I don’t want to add the div in Gutenberg because I want to make this easy for the client too. Basically this is my code:

But when I run that, the console reports an error about syntax and I think this happens because when the function returns the content (with HTML tags) it creates line breaks for every HTML element, not to mention the <– wp:paragraph –> tags as well. So this messes up with the string to be read by .html().

How would you approach solving this problem, please?

Thanks in advance.

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com