Answer the question
In order to leave comments, you need to log in
Getting full paragraph into selected text?
Current state jsfiddle.net/dan2b5o2/2
How, if not a full paragraph/paragraphs are selected, how to drag the text of a full paragraph into the $txt variable with the closing and opening tags inclusive.
Answer the question
In order to leave comments, you need to log in
If I understand correctly, then you can do something like this:
1 remember the clicked element
2 .closest('p') and .html()
demo: jsfiddle.net/dan2b5o2/5
I did it like this, jsfiddle.net/dan2b5o2/3 but it's not very clear how to check for parentNode.name
in order to exclude the choice of tags inside the paragraph, such a construction console.log(container.parentElement.nodeName);
in IE gives an error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question