hello i want i have function to get paragraph of selected text.
this is the function to get current paragraph of selected text
function getSelected() {
var userSelection;
if (window.getSelection) {
selection = window.getSelection();
} else if (document.selection) {
selection = document.selection.createRange();
}
var parent = selection.anchorNode;
parent = parent.parentNode;
alert(parent.innerHTML);
}
how can i get next-previous paragraph of selected text in web page. if i have function to get current paragraph above. (i think to use nextSibling but i don't know to implement it in code above) can you help me?
-thank you-