Is it possible to select text (as if the user dragged his mouse across an HTML word in the browser) with the help of Javascript?
I have some JS code that searches an HTML table for a user's string input. I would then like for this code to select/focus on this word if it is found.
var targetTable = document.getElementById("accountTable");
for (var rowIndex = 1 + searchStart; rowIndex < targetTable.rows.length; rowIndex++)
{
var rowData = '';
rowData = targetTable.rows.item(rowIndex).cells.item(0).textContent;
if (rowData.indexOf(str) != -1)
{
//select word and focus on it in user's browser?
}
}