0

I am developing a simple project using bootstrap. I have this code that can create a button inside a dataTable and it is working fine. I try to put an image to it not glyphicons by the code that I provided below as you can see.. But it's not working. But the glyphicon icon in First button is working.

{ data: "ActionMenu", title: "Test", sClass: "alignCenter","mRender": function (data) {
   return '<button type="button" class="btn btn-info btn-md action" id="checkId"><i class="fa fa-dollar fa-fw action"></i></button>'
   + '&nbsp; <button type="button" class="btn btn-danger btn-md action" id="checkId2" src="Images/TestPicture.png"></button>';
}
KiRa
  • 924
  • 3
  • 17
  • 42
  • "But it's not working" what do you mean ? can you see the image if you access to it directly ? does the console say anything ? – gobes Feb 16 '17 at 08:11
  • @gobes I don't have any error in console. What I mean in not working the Image that I provided using the code is not displaying. – KiRa Feb 16 '17 at 08:12

2 Answers2

1

You can't give a src to a button element. Try to put an <img> element inside the button:

<button type="button" class="btn btn-danger btn-md action" id="checkId2">
    <img src="Images/TestPicture.png"/>
</button>
gobes
  • 507
  • 7
  • 25
1
 <button id="imageId type="button"><img src="path/of/image"></button>

Appy css with the help of ID if required

Biyu
  • 513
  • 1
  • 5
  • 30