I am coding a log message box / same function as a chat and I would like to set my AutoScrollDown Boolean to false once someone selects text inside of the chat (if the user wants paste something for example).
I realized my log message/chat box with an ul and lis, which looks like this:
<ul id="1" class="logbox">
<li class="debug"><b>At</b> w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.learn how to make a website. We offer free tutorials in all web development technologies.</li>
<li class="error"><b>At</b> w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.</li>
<li class="warning"><b>At</b> w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.</li>
<li>blabla</li>
</ul>
I have tried the following events to check if content inside of my ul is selected or not, which didn't work:
$("#1").on("focus", function() {
autoScrollEnabled = 0;
});
$("#1").off("focus", function() {
autoScrollEnabled = 1;
});
My question:
How can I set autoScrollEnabled
to 0 once someone selects/highlights text inside of my ul and how can I check if the user has stopped selecting/highligting any text.