Answer the question
In order to leave comments, you need to log in
How to copy information from div using .text js without losing formatting?
How to copy information from a div using .text js without losing formatting:
There is a div, it has headings, li (with a list of products), total amount and quantity (span)
Using the .text function, I copy the text to another block (to then transfer it to textarea in email form).
As a result, the data is copied, but I want to keep the original formatting (indents, etc.)
Answer the question
In order to leave comments, you need to log in
Use .html() instead of .text()
PS:
var newtext = $('div').text().replace(/<[^>]*>/g, "\n");
- © vvrider
Margins are created using css, and how can you get them using js with a single function? No way ... you need to parse them and look at what is on this element.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question