Prevent Link Selection

Prevent Link Selection

HTML

<html>
   <body>
         <div>
         <a id="a1" target="_blank" href="" draggable="false" >
                  This is selectable - First Line
                     <div>
                     This is selectable - Second Line
                     </div>
                  </a>
         
                  <a id="a2" target="_blank" href="">
                  This is NOT selectable - First Line
                     <div>
                     This is NOT selectable - Second Line
                     </div>
                  </a>
               </div>
   </body>
</html>

CSS

a#a1:link, a#a1:link *
{
    cursor: auto !important;
    -webkit-user-select: text !important;
    -moz-select: text !important;
    -ms-select: text !important;
    user-select: text !important;
}

JavaScript

document.addEventListener('dragstart',function(evt){
evt.preventDefault()
console.log("dragstart prevented")
})