How do I prevent selecting text in AngularJS on ng-dblclick?

前端 未结 1 521
礼貌的吻别
礼貌的吻别 2021-02-14 01:07

I have an element with ng-dblclick=\'doSomthing()\' which works fine, but has the ugly side effect of selecting the text in the element too. It there any way to pre

1条回答
  •  悲&欢浪女
    2021-02-14 01:57

    Try to add these css rules to your class or div that you want to prevent the text selection of

    .myClass {
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
    

    0 讨论(0)
提交回复
热议问题