In my JavaScript file, I have buttons that look like this:
var myButton = $('<button type="button" style="display:inline">Translate Right</button>');
myButton.css({"margin-top":"5px", "float":"left"});
Now, I want to replace the text "Translate Right" with an icon. Here is what I tried:
var myButton = $('<button type="button" style="display:inline">Translate Right</button>');
myButton.css({"margin-top":"5px", "float":"left"});
$('body').append(myButton);
myButton.html('<img src="path\to\image">'); // backslash because I'm using windows
Unfortunately, this approach is not working. The button is empty and I receive an error saying "Not allowed to load local resource." I attempted changing "url" to "src" but it did not solve the issue. The button remains empty.
For reference, I successfully replaced the text with a different image from . However, I'm still facing difficulties in loading the local image.
If you could provide some guidance or assistance, I would greatly appreciate it. Thank you.