Table contain digital values, each cell has each own href.
If I'm apply hrefs like this:
nTd.click(function(e){
$(this).css("font-weight","bold");
e.stopPropagation();
location.href = 'http://google.com';
});
Each click on cell redirect window, I can't open new tab by "ctrl + click".
If I would add in TD something like '<a href="http://google.com"> 123123 </a>', then sorting through digital values would breaks, into lexicographical order.
Make a check to see whether the CTRL key was down when the event occured:
nTd.click(function(e){
$(this).css("font-weight","bold");
e.stopPropagation();
if(e.originalEvent.ctrlKey || e.originalEvent.metaKey){
window.open("http://www.google.com", "_blank");
} else {
location.href = 'http://google.com';
}
});
JSFiddle
You won't see the page change in the fiddle, but you'll see the error it produces in the console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With