I have a situation like this
<div id="Arabic-1:1" class="arabic-text translation-area" dir="rtl">
بِسْمِ اللّهِ الرَّحْمـَنِ الرَّحِيمِ
</div>
I want users to do double click on each arabic word and get a pop up showing the english meaning of that clicked word.
since each double click action can select only one word, and I have the definitions for each and every word, this plan will work however, I do not want to overload the HTML with so many ids and delimiters, and data attributes, making the size of the arabic division 10+ times the size.
For this I thought, identifying the index number of the words programmatically.
Placing an onclick event on the div itself and then figuring out was it the first, second, third or the forth arabic word clicked will suffice.
Since the div id "Arabic-1:1" already gives away the verse ref as chapter 1 verse 1, all you have to do is to figure out these index numbers programmatically
4بِسْمِ1 اللّهِ2 الرَّحْمـَنِ3 الرَّحِيمِ
is there an easy and smart way to do this?
before I end up doing <span onclick=popMeaning("1.1.4")> الرَّحْمـَنِ</span>
approach?