获取所选文本的HTML源代码?

时间:2016-05-03 10:14:25

标签: javascript jquery html dom

我有一个页面上有博客文章。人们可以选择本文的一部分,我想存储他们选择的部分,但不仅仅是屏幕上的文本,HTML源。

示例,屏幕显示;

  

Boerboel育种者协会于1983年在Senekal地区成立

完整代码为:

<p>
    The Boerboel Breeders Association was <strong>established in 1983</strong> in the Senekal district.
</p>

所以我希望当有人选择“1983年在Senekal区成立”时,它会返回给我源代码:

was <strong>established in 1983</strong> in the Senekal district

我正在使用Javascript&amp; jQuery的。

0 个答案:

没有答案