Robert Benedetto Robert Benedetto - 10 months ago 71
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;'

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download