Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: Allow text selection inside <a>

Tags:

html

jquery

css

When trying to select text inside a, it's just dragging link.

Is it possible to disable this behavior while keeping link clickable?

Thanks ;)

like image 735
Somebody Avatar asked Oct 11 '22 01:10

Somebody


2 Answers

Make a fake link with CSS on a span and bind your events.

Use :hover CSS selector

I made it for you with this JSFiddle Demo

like image 86
AlexBay Avatar answered Oct 17 '22 23:10

AlexBay


I think inside an <a> it is not possible, because the dragging is the behaviour of a lot of browsers to allow drag and drop of links betweens applications. You could work around this using JavaScript and by using another HTML element as a link, but that is miss-use in my opinion.

like image 20
Manuel Leuenberger Avatar answered Oct 17 '22 22:10

Manuel Leuenberger