In JavaScript, is it possible to obtain a specific line from a paragraph that is displayed on a page?
For example, here I'm trying to obtain the 3rd line of a paragraph as a string:
JavaScript:
//this function should return the specified line from the specified paragraph.
function getLine(paragraphId, lineNum){
//for example, getLine("sampleParagraph", 1); should return
// tore but year. An from mean on with when sing pain. Oh to as principles devonshire
}
HTML:
<p id = "sampleParagraph">
Instrument cultivated alteration any favourable expression law far nor. Both new like tore but year. An from mean on with when sing pain. Oh to as principles devonshire companions unsatiable an delightful. The ourselves suffering the sincerity. Inhabit her manners adapted age certain. Debating offended at branched striking be subjects.
</p>
Here it is on jsfiddle (showing how the paragraph is displayed): http://jsfiddle.net/RrXWW/