1
I created a page that displays database data in a table, generated through the plugin dataTables (Jquery). It works as follows: when the user clicks on the table row, it is redirected to an edit page.
The line of code that does this redirect is:
$("#tabela-estacoes td").click(function() {
window.location = "editar-estacoes-trabalho.php?id=" + $(this).parent("tr").attr('identifier');
});
My question is this: how do I stop instead of redirecting the page, open this data in a new tab?
Hananiamizrahi, thanks for the reply. I use this code in my service and now I have no way to test... But only by changing the window.Location to Location.href the current page will remain displayed and the line data I selected will open in a new tab?
– Handrick
To open in a new page you exchange Location.href and boot window.open('LINK', '_Blank') ai funciona como vc quer.
– HananiaMizrahi
I’ve done it this way and it didn’t work $("#table-stations td"). click(Function() { window.open = ("edit-stations-work.php? id=" +," _Blank") $(this). Parent("tr"). attr('Identifier');
– Handrick
Neither $("#table-stations td"). click(Function() { window.open = ("edit-stations-work.php? id=" +," _Blank");
– Handrick
Friend, the function window.open() requires 2 parameters, which are the first one you want to open, and the second one is the way this link will be opened, in the case _Blank... type like this -> window.open('http://meulink.com.br','_Blank');
– HananiaMizrahi
I edited the answer above, try to see if it works, here it ran bacaninha! In addition, make sure that the jquery framework is being called...
– HananiaMizrahi