Robert Benedetto Robert Benedetto - 1 month ago 9
Javascript Question

Javascript in Datatables cell

I am using Jquery Datatables, and have to have confirmation scripts in certain cells. However, since the use of ' causes the script to not fire (' within '), how can I get around this? Example below (the onclick event won't fire, I get sent to the link immediately).

var dataSet = [["<a href='member_search.aspx' onclick='return confirm('Please confirm?'); return false;' class='btn btn-danger btn-xs'>radera</a>", "Test1", "Test1", "Test1", "<a href='member_details.aspx'>info</a>"]]

Answer Source

Just use &quot; :

onclick='return confirm(&quot;Please confirm?&quot;); return false;'