I have a view with a table, the last column is a link but should be a button. So in the last field i enable rewrite output and add this code

<button type="button" class="btn btn-default">

I am using the bootstrap theme. But views is filtering out the button code. What is the fasted way to change the link into a button?


It might not be what you need, but in Bootstrap you can create buttons using the <a> anchor, which will not be filtered out by Views.

  <a class="btn btn-default" href="#">
  • 1
    Thanks that works on some fields. But not this field. Views outputs this as:<a href="/node/1/clone/GWuOFvCfNwMpz182dJajjHoqOsFeAYS29YRzgHb248k?node-clone-destination=subco-overzicht"></a> <a class="btn btn-default" href="#"> dupliceren </a> – GoempieK Oct 27 '16 at 14:18
  • 1
    I found this works by placing a button even when using the same classes, and closing with the </a> tag instead of </button> – Guybrush Threepwood Nov 26 '18 at 22:45
  • 2
    Thanks @Will, you are completely right! The </button> closing tag was of course wrong. I have just corrected it. – dinopmi Nov 27 '18 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.