kamranahmedse / jquery-toast-plugin

Highly customizable jquery plugin to show toast messages
http://kamranahmed.info/toast
1.51k stars 506 forks source link

When adding html, toast changes the html to all lowercase #38

Closed gishman closed 4 years ago

gishman commented 6 years ago

$.toast({ text: '<span onclick($("#Clubmembers").tabulator("deselectRow", "1111"))>Smith, Madelyn'})

results in : <span onclick($("#clubmembers").tabulator("deselectrow",="" "1111"))="">Smith, Madelyn</span>

ft-harai commented 6 years ago

Hello. I guess it's not concerned with this toast plugin. Just appending to body instead of using $.toast(), you will see the same issue:

$('body').append('<span onclick($("#Clubmembers").tabulator("deselectRow", "1111"))>Smith, Madelyn');

The correct markup with onclick attribute should be not onclick(...) but onclick="...". Then try the below:

$.toast({
  text: "<span onclick=\"$('#Clubmembers').tabulator('deselectRow', '1111')\">Smith, Madelyn</span>"
});
sgbeal commented 6 years ago

That's not this plugin, but is either jQuery OR the browser (it could be either one). You can see this in a JS console with:

> var x = $('<span onclick($("#Clubmembers").tabulator("deselectRow", "1111"))>Smith, Madelyn</span>')
w.fn.init [span]
> x[0]
<span onclick($("#clubmembers").tabulator("deselectrow", "1111"))>​Smith, Madelyn​</span>​