Reputation: 988
I am trying to replace Delete word with Font Awesome icon in jQuery. I have googling and searching but not find any solution.
JS
columns: [
{ "data" : "filename",
render: function ( data ) {
return "<span onclick='download_file(""+data+"")'>Download</span> / <span onclick='delete_file(""+data+"")'>Delete</span>";
} }
],
Font Awesome
<i class="fa fa-trash" aria-hidden="true"></i>
Upvotes: 2
Views: 90
Reputation: 666
You can directly have your icon code in your render return string like below
render: function ( data ) {
return "<span onclick='download_file(""+data+"")'>Download</span> / <span onclick='delete_file(""+data+"")'><i class='fa fa-trash' aria-hidden='true'></i></span>";
}
But only thing when you rendering this element in DOM then you should use html
method of jquery like below
$('Your Selector').html(render_function_call);
Upvotes: 2