After writing the html expression as a string in javascript and append it, the quotes get mixed up.
var string ="<a href='javascript:;' onclick='toastr.clear('$(this).closest('.toast-bottom-left')');' class='ml-2' id='approve_button'>Kabul Et</a>"
After append it takes the following state.
<a href="javascript:;" onclick="toastr.clear(" $(this).closest('.toast-bottom-left')');'="" class="ml-2" id="approve_button">Kabul Et</a>