Widget:Highlight: Difference between revisions

From Rangjung Yeshe Wiki - Dharma Dictionary
Jump to navigation Jump to search
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 1: Line 1:
<script>  
<script>
function highlight(text) {
 
var inputText = document.getElementById("bodyContent");
$(".highlight").mark("<!--{$term}-->");
var innerHTML = inputText.innerHTML;
var index = innerHTML.indexOf(text);
if (index >= 0) {
innerHTML = innerHTML.substring(0,index) + "<span class='mark'>" + innerHTML.substring(index,index+text.length) + "</span>" + innerHTML.substring(index + text.length);
inputText.innerHTML = innerHTML;
}
}
window.onload = highlight("<!--{$term}-->");
</script>
</script>

Revision as of 22:10, 13 September 2021

<script>

$(".highlight").mark(""); </script>