I am trying to create a button
using the createElement
method in JavaScript. I want to include a bootstrap delete icon within this button
.
This is my current code:
const deleteButton = document.createElement('button');
deleteButton.innerHTML = '<i class="bi bi-trash"></i> Delete'
document.body.append(deleteButton);
However, when I view the button in Chrome, only the text "Delete" appears inside the button. I have already linked the Bootstrap stylesheet and script files in my HTML.
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="482a27273c3b3c3a2938087d66786678652a2d3c297b">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">