My goal is to develop a unique text editor that can send Ajax requests when a word is hovered. The code snippet below shows my progress so far:
<div class="word_split" contenteditable="true">Don't break my heart.</div>
Included in the page, we have some jQuery scripts:
$(document).ready(function () {
$(".word_split").hover(function () {
if ($(".word_split").children().length == 0) {
$(".word_split").lettering('words');
}
else {
$(".word_split").children().lettering('words');
}
});
});
$(document).ready(function () {
$(".word_split span").hover(function () {
//Ajax requests will be made here
alert("sadfsdafsa");
});
});
Additionally, there is CSS styling:
.word_split span:hover {
font-weight:bold;
}
The 'Lettering' function separates each word in the target tag into spans with unique classes like word1, word2, and so on.
I've encountered an issue where the second jQuery function doesn't work as expected, while the CSS styling works fine. I'm seeking help to understand why this behavior is happening and how I can resolve it. Thank you!