How do I select a word using Jquery and save that into DB. ie, Say I have the following in my page,
"<p>This is a beautiful sentence </p>"
If I click on 'beautiful', I want to show a pop up option "add". If I click on "add", the word "beautiful" will be saved in my existing database of words. If i click it again It wont be saved, the database contains unique words.
I am working in Django.
Edit: I tried the following:
<script>
$(document).ready(function(){
$("p").click(function(){
var value = $(this).text();
var input = $('#my_input');
input.val(value);
});
});
</script>
This is a beautiful sentence
` – Taplar Nov 15 '18 at 18:57`, not just one word. There are difficult ways to identify a word by the location that was clicked, but I would advise finding a better way to tag the words.
– Twisty Nov 15 '18 at 19:01