I am trying to make a page that allows user after clicking on a word to get a small suggestion box (like a relly small popup) where he can click and choose synonyms that he wants.
I am not sure in what language this could be done probably javascript but I didn't find any examples for that.
The html code is bellow:
Original:
I <b class="synonyms" style="color:black;"
title="love|really like|really love">like</b> apples.
The result should be(after a user chooses synonyms):
I <b>{like|love}</b> apples.
So for examples when he click on "like" from the sentence "I like apples" there should be a small suggestion box where he could choose among all the suggested options (love|really like|really love).
In the results is original plus what he chooses.
This is an example i javascript, however I am not sure if there is a way to click on specific word (there could be more than one word in a sentence), and also is there way to style the suggestion box and add list of words to choose from by clicking on them.
<!DOCTYPE html>
<html>
<body>
<p>I <b id="demo">like</b> apples.</p>
<button onclick="choose()">Try it</button>
<script>
function choose() {
var synonym = prompt("Choose synonyms:", "like");
if (synonym != null) {
document.getElementById("demo").innerHTML =
"{" + "like" + "|" + synonym + "}";
}
}
</script>
</body>
</html>