How to avoid select event when click on a hyperlink
How to avoid select event when click on a hyperlink

I've created this example, the last column is the hyperlink.
I am wondering if there is a way to prevent triggering the "select row event" when I click on the hyperlink.
http://live.datatables.net/gabihiro/2/
thanks,
This discussion has been closed.
Answers
Put your link in a < span > inside your < td >, and confine your "select" to the < td >.
No doubt there are other ways. This one works for me.
I modified my example, but looks like it doesn't work.
Do you see anything missing here?
http://live.datatables.net/mefesiwe/1/
I should have been clearer. I meant the whole of the link code, that is, your < a > code.
td span a /a /span /td
you mean something like this? seems like not working.
<span a target="_blank" rel="noopener noreferrer" href="'+'http://'+data+'">Link</a /span>
Do you mind edit on my sample?
http://live.datatables.net/mefesiwe/1/
I assumed that you understood HTML.
<td>
<span>
<a ....>....</a>
</span>
</td>
Not sure why, but still not working. changed to
<td><span class="weblink"><a target="_blank" rel="noopener noreferrer" href="'+'http://'+data+'">Link</a></span></td>
http://live.datatables.net/colekaxu/1/edit
appreciate if you can take another look. thanks,
Another option is to use
select.selector
to not use last column:Colin
I'm conceding defeat now. I just spotted an instance on my own site where this idea isn't working. I'll have to check out a wider sample of my own coding. Apologies if I wasted your time.
Use Colin's suggestion, which does work.
anyway, I found this. works perfectly.
table.on( 'user-select', function ( e, dt, type, cell, originalEvent ) {
if ( originalEvent.target.nodeName.toLowerCase() === 'a' ) {
return false;
}
} );
Ah nice, thanks for reporting back,
Colin